From e945367b281dc3b66582416901afbe3c757d4016 Mon Sep 17 00:00:00 2001 From: leo Date: Sun, 29 Sep 2024 12:11:09 +0800 Subject: [PATCH] enhance: avoid re-calcuting highlight chunk when move mouse from stage/unstage buttons to text area --- src/Views/TextDiffView.axaml.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/Views/TextDiffView.axaml.cs b/src/Views/TextDiffView.axaml.cs index 02564428..4de04eaf 100644 --- a/src/Views/TextDiffView.axaml.cs +++ b/src/Views/TextDiffView.axaml.cs @@ -513,7 +513,17 @@ namespace SourceGit.Views private void OnTextViewPointerEntered(object sender, PointerEventArgs e) { if (EnableChunkSelection && sender is TextView view) + { + var chunk = SelectedChunk; + if (chunk != null) + { + var rect = new Rect(0, chunk.Y, Bounds.Width, chunk.Height); + if (rect.Contains(e.GetPosition(this))) + return; + } + UpdateSelectedChunk(e.GetPosition(view).Y + view.VerticalOffset); + } } private void OnTextViewPointerMoved(object sender, PointerEventArgs e)