This repository was archived by the owner on Oct 16, 2020. It is now read-only.
File tree Expand file tree Collapse file tree
src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -966,14 +966,14 @@ protected override void OnPreviewKeyUp(KeyEventArgs e)
966966 protected override void OnKeyDown ( KeyEventArgs e )
967967 {
968968 base . OnKeyDown ( e ) ;
969- TextView . InvalidateCursor ( ) ;
969+ TextView . InvalidateCursorIfMouseWithinTextView ( ) ;
970970 }
971971
972972 /// <inheritdoc/>
973973 protected override void OnKeyUp ( KeyEventArgs e )
974974 {
975975 base . OnKeyUp ( e ) ;
976- TextView . InvalidateCursor ( ) ;
976+ TextView . InvalidateCursorIfMouseWithinTextView ( ) ;
977977 }
978978 #endregion
979979
Original file line number Diff line number Diff line change @@ -1165,7 +1165,7 @@ protected override Size ArrangeOverride(Size finalSize)
11651165 }
11661166 }
11671167 }
1168- InvalidateCursor ( ) ;
1168+ InvalidateCursorIfMouseWithinTextView ( ) ;
11691169
11701170 return finalSize ;
11711171 }
@@ -1636,6 +1636,15 @@ public static void InvalidateCursor()
16361636 }
16371637 }
16381638
1639+ internal void InvalidateCursorIfMouseWithinTextView ( )
1640+ {
1641+ // Don't unnecessarily call Mouse.UpdateCursor() if the mouse is outside the text view.
1642+ // Unnecessary updates may cause the mouse pointer to flicker
1643+ // (e.g. if it is over a window border, it blinks between Resize and Normal)
1644+ if ( this . IsMouseOver )
1645+ InvalidateCursor ( ) ;
1646+ }
1647+
16391648 /// <inheritdoc/>
16401649 protected override void OnQueryCursor ( QueryCursorEventArgs e )
16411650 {
You can’t perform that action at this time.
0 commit comments