Skip to content

Commit 6dbcfd2

Browse files
authored
Fix Rename adornment positioning after scrolling (#79303)
When Rename is invoked after scrolling up, the adornment is occasionally displayed misplaced out of viewport. See https://developercommunity.visualstudio.com/t/Rename-dialog-opens-up-outside-of-editor/10919621. This is a regression from #77466, which was a fix for horizontal clipping but also changed vertical positioning to never be negative. Unfortunately, when scrolling up, text view's viewport top and bottom can be negative. The fix is to remove unnecessary Math.Max on top position value.
2 parents cf93d99 + 5085779 commit 6dbcfd2

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/EditorFeatures/Core.Wpf/InlineRename/UI/Adornment/RenameFlyout.xaml.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,8 @@ private void PositionAdornment()
152152
MaxWidth = _textView.ViewportRight;
153153
MinWidth = Math.Min(DefaultMinWidth, _textView.ViewportWidth);
154154

155-
Canvas.SetTop(this, Math.Max(0, top));
155+
// Top can be negative if the viewport is scrolled up, but not left
156+
Canvas.SetTop(this, top);
156157
Canvas.SetLeft(this, Math.Max(0, left));
157158
}
158159

0 commit comments

Comments
 (0)