Skip to content

Commit

Permalink
Merge pull request #370 from Washi1337/issue/onquerycursor
Browse files Browse the repository at this point in the history
BUGFIX: Re-enable OnQueryCursor calls for text elements in TextView.
  • Loading branch information
Gillibald authored Feb 29, 2024
2 parents a484355 + 305d52a commit c805978
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/AvaloniaEdit/Rendering/TextView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ static TextView()

private readonly ColumnRulerRenderer _columnRulerRenderer;
private readonly CurrentLineHighlightRenderer _currentLineHighlightRenderer;
private VisualLineElement _currentHoveredElement;

/// <summary>
/// Creates a new TextView instance.
Expand Down Expand Up @@ -1603,15 +1604,16 @@ protected override void OnPointerMoved(PointerEventArgs e)
{
base.OnPointerMoved(e);

//var element = GetVisualLineElementFromPosition(e.GetPosition(this) + _scrollOffset);
var element = GetVisualLineElementFromPosition(e.GetPosition(this) + _scrollOffset);

//// Change back to default if hover on a different element
//if (_currentHoveredElement != element)
//{
// Cursor = Parent.Cursor; // uses TextArea's ContentPresenter cursor
// _currentHoveredElement = element;
//}
//element?.OnQueryCursor(e);
// Change back to default if hover on a different element
if (_currentHoveredElement != element)
{
Cursor = Parent?.GetValue(CursorProperty); // uses TextArea's ContentPresenter cursor
_currentHoveredElement = element;
}

element?.OnQueryCursor(e);
}

protected override void OnPointerPressed(PointerPressedEventArgs e)
Expand Down

0 comments on commit c805978

Please sign in to comment.