enhance: update selected chunk after stage/discard/unstage previous chunk (#361)

This commit is contained in:
leo 2024-08-16 15:11:35 +08:00
parent 6ac7ff2882
commit 6d11296eae
No known key found for this signature in database

View file

@ -409,6 +409,7 @@ namespace SourceGit.Views
base.OnLoaded(e); base.OnLoaded(e);
TextArea.TextView.ContextRequested += OnTextViewContextRequested; TextArea.TextView.ContextRequested += OnTextViewContextRequested;
TextArea.TextView.PointerEntered += OnTextViewPointerEntered;
TextArea.TextView.PointerMoved += OnTextViewPointerMoved; TextArea.TextView.PointerMoved += OnTextViewPointerMoved;
TextArea.TextView.PointerWheelChanged += OnTextViewPointerWheelChanged; TextArea.TextView.PointerWheelChanged += OnTextViewPointerWheelChanged;
@ -420,6 +421,7 @@ namespace SourceGit.Views
base.OnUnloaded(e); base.OnUnloaded(e);
TextArea.TextView.ContextRequested -= OnTextViewContextRequested; TextArea.TextView.ContextRequested -= OnTextViewContextRequested;
TextArea.TextView.PointerEntered -= OnTextViewPointerEntered;
TextArea.TextView.PointerMoved -= OnTextViewPointerMoved; TextArea.TextView.PointerMoved -= OnTextViewPointerMoved;
TextArea.TextView.PointerWheelChanged -= OnTextViewPointerWheelChanged; TextArea.TextView.PointerWheelChanged -= OnTextViewPointerWheelChanged;
@ -480,6 +482,12 @@ namespace SourceGit.Views
e.Handled = true; e.Handled = true;
} }
private void OnTextViewPointerEntered(object sender, PointerEventArgs e)
{
if (EnableChunkSelection && sender is TextView view)
UpdateSelectedChunk(e.GetPosition(view).Y + view.VerticalOffset);
}
private void OnTextViewPointerMoved(object sender, PointerEventArgs e) private void OnTextViewPointerMoved(object sender, PointerEventArgs e)
{ {
if (EnableChunkSelection && sender is TextView view) if (EnableChunkSelection && sender is TextView view)