Skip to content

Commit 2a9f2e7

Browse files
committed
fix(gutter): prevent tooltip flicker with line tracking
1 parent 426a92a commit 2a9f2e7

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

src/CodingWithCalvin.GitRanger/Editor/GutterMargin/BlameMargin.cs

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ internal sealed class BlameMargin : Canvas, IWpfTextViewMargin
3333
private string? _currentFilePath;
3434
private bool _isLoading;
3535
private bool _isDisposed;
36+
private int _currentTooltipLine = -1;
3637

3738
/// <summary>
3839
/// Creates a new blame margin for the given text view.
@@ -337,19 +338,30 @@ private void OnMouseMove(object sender, MouseEventArgs e)
337338
if (blameInfo != null)
338339
{
339340
Cursor = Cursors.Hand;
340-
_tooltipPopup.Child = CreateTooltip(blameInfo);
341-
_tooltipPopup.IsOpen = true;
341+
342+
// Only update popup if line changed
343+
if (_currentTooltipLine != blameInfo.LineNumber)
344+
{
345+
_currentTooltipLine = blameInfo.LineNumber;
346+
_tooltipPopup.Child = CreateTooltip(blameInfo);
347+
_tooltipPopup.IsOpen = true;
348+
}
342349
}
343350
else
344351
{
345352
Cursor = Cursors.Arrow;
346-
_tooltipPopup.IsOpen = false;
353+
if (_currentTooltipLine != -1)
354+
{
355+
_currentTooltipLine = -1;
356+
_tooltipPopup.IsOpen = false;
357+
}
347358
}
348359
}
349360

350361
private void OnMouseLeave(object sender, MouseEventArgs e)
351362
{
352363
Cursor = Cursors.Arrow;
364+
_currentTooltipLine = -1;
353365
_tooltipPopup.IsOpen = false;
354366
}
355367

0 commit comments

Comments
 (0)