From 32c0aa61cd6080bccf24fb098936b2c55eff9ff3 Mon Sep 17 00:00:00 2001 From: leo Date: Mon, 9 Sep 2024 21:01:10 +0800 Subject: [PATCH] fix: the highlight background not updated while scrolling using mouse wheel without focus the text editor control (#448) --- src/Views/Blame.axaml.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Views/Blame.axaml.cs b/src/Views/Blame.axaml.cs index 1146835c..56fd4c2b 100644 --- a/src/Views/Blame.axaml.cs +++ b/src/Views/Blame.axaml.cs @@ -234,6 +234,7 @@ namespace SourceGit.Views TextArea.LeftMargins.Add(new CommitInfoMargin(this) { Margin = new Thickness(8, 0) }); TextArea.LeftMargins.Add(new VerticalSeperatorMargin(this)); TextArea.LayoutUpdated += OnTextAreaLayoutUpdated; + TextArea.PointerWheelChanged += OnTextAreaPointerWheelChanged; TextArea.TextView.ContextRequested += OnTextViewContextRequested; TextArea.TextView.VisualLinesChanged += OnTextViewVisualLinesChanged; TextArea.TextView.Margin = new Thickness(4, 0); @@ -333,6 +334,12 @@ namespace SourceGit.Views InvalidateVisual(); } + private void OnTextAreaPointerWheelChanged(object sender, PointerWheelEventArgs e) + { + if (!TextArea.IsFocused) + Focus(); + } + private void OnTextViewContextRequested(object sender, ContextRequestedEventArgs e) { var selected = SelectedText;