From 33bc82414b94d4efafb0eb5140c55871e9e4b51f Mon Sep 17 00:00:00 2001 From: Washi Date: Fri, 1 Sep 2023 17:55:46 +0200 Subject: [PATCH] BUGFIX: Re-enable OnQueryCursor calls for text elements in TextView. --- src/AvaloniaEdit/Rendering/TextView.cs | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/AvaloniaEdit/Rendering/TextView.cs b/src/AvaloniaEdit/Rendering/TextView.cs index 83a430c9..58d14e3b 100644 --- a/src/AvaloniaEdit/Rendering/TextView.cs +++ b/src/AvaloniaEdit/Rendering/TextView.cs @@ -67,6 +67,7 @@ static TextView() private readonly ColumnRulerRenderer _columnRulerRenderer; private readonly CurrentLineHighlightRenderer _currentLineHighlightRenderer; + private VisualLineElement _currentHoveredElement; /// /// Creates a new TextView instance. @@ -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)