mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-25 21:07:20 -08:00
fix: hightlight not working the first time clicking the first line (#448)
This commit is contained in:
parent
f42ddd8cee
commit
f5b8bc472a
1 changed files with 10 additions and 1 deletions
|
@ -233,6 +233,7 @@ namespace SourceGit.Views
|
||||||
TextArea.LeftMargins.Add(new VerticalSeperatorMargin(this));
|
TextArea.LeftMargins.Add(new VerticalSeperatorMargin(this));
|
||||||
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.Caret.PositionChanged += OnTextAreaCaretPositionChanged;
|
||||||
TextArea.LayoutUpdated += OnTextAreaLayoutUpdated;
|
TextArea.LayoutUpdated += OnTextAreaLayoutUpdated;
|
||||||
TextArea.PointerWheelChanged += OnTextAreaPointerWheelChanged;
|
TextArea.PointerWheelChanged += OnTextAreaPointerWheelChanged;
|
||||||
TextArea.TextView.ContextRequested += OnTextViewContextRequested;
|
TextArea.TextView.ContextRequested += OnTextViewContextRequested;
|
||||||
|
@ -279,7 +280,9 @@ namespace SourceGit.Views
|
||||||
base.OnUnloaded(e);
|
base.OnUnloaded(e);
|
||||||
|
|
||||||
TextArea.LeftMargins.Clear();
|
TextArea.LeftMargins.Clear();
|
||||||
|
TextArea.Caret.PositionChanged -= OnTextAreaCaretPositionChanged;
|
||||||
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;
|
||||||
|
|
||||||
|
@ -312,7 +315,7 @@ namespace SourceGit.Views
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnTextAreaLayoutUpdated(object sender, EventArgs e)
|
private void OnTextAreaCaretPositionChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (!TextArea.IsFocused)
|
if (!TextArea.IsFocused)
|
||||||
return;
|
return;
|
||||||
|
@ -325,6 +328,12 @@ namespace SourceGit.Views
|
||||||
InvalidateVisual();
|
InvalidateVisual();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OnTextAreaLayoutUpdated(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (TextArea.IsFocused)
|
||||||
|
InvalidateVisual();
|
||||||
|
}
|
||||||
|
|
||||||
private void OnTextAreaPointerWheelChanged(object sender, PointerWheelEventArgs e)
|
private void OnTextAreaPointerWheelChanged(object sender, PointerWheelEventArgs e)
|
||||||
{
|
{
|
||||||
if (!TextArea.IsFocused && !string.IsNullOrEmpty(_highlight))
|
if (!TextArea.IsFocused && !string.IsNullOrEmpty(_highlight))
|
||||||
|
|
Loading…
Reference in a new issue