fix: the highlight background not updated while scrolling using mouse wheel without focus the text editor control (#448)

This commit is contained in:
leo 2024-09-09 21:01:10 +08:00
parent 24301751d3
commit 32c0aa61cd
No known key found for this signature in database

View file

@ -234,6 +234,7 @@ namespace SourceGit.Views
TextArea.LeftMargins.Add(new CommitInfoMargin(this) { Margin = new Thickness(8, 0) }); TextArea.LeftMargins.Add(new CommitInfoMargin(this) { Margin = new Thickness(8, 0) });
TextArea.LeftMargins.Add(new VerticalSeperatorMargin(this)); TextArea.LeftMargins.Add(new VerticalSeperatorMargin(this));
TextArea.LayoutUpdated += OnTextAreaLayoutUpdated; TextArea.LayoutUpdated += OnTextAreaLayoutUpdated;
TextArea.PointerWheelChanged += OnTextAreaPointerWheelChanged;
TextArea.TextView.ContextRequested += OnTextViewContextRequested; TextArea.TextView.ContextRequested += OnTextViewContextRequested;
TextArea.TextView.VisualLinesChanged += OnTextViewVisualLinesChanged; TextArea.TextView.VisualLinesChanged += OnTextViewVisualLinesChanged;
TextArea.TextView.Margin = new Thickness(4, 0); TextArea.TextView.Margin = new Thickness(4, 0);
@ -333,6 +334,12 @@ namespace SourceGit.Views
InvalidateVisual(); InvalidateVisual();
} }
private void OnTextAreaPointerWheelChanged(object sender, PointerWheelEventArgs e)
{
if (!TextArea.IsFocused)
Focus();
}
private void OnTextViewContextRequested(object sender, ContextRequestedEventArgs e) private void OnTextViewContextRequested(object sender, ContextRequestedEventArgs e)
{ {
var selected = SelectedText; var selected = SelectedText;