From 53efce72fa4bb883e9892d64be3eaab2a1e54d9e Mon Sep 17 00:00:00 2001 From: Dmitry Maluka Date: Thu, 22 Oct 2020 22:54:46 +0200 Subject: [PATCH] hltrailingws: improve behavior with selection Improve user experience: if we are at a line with a new (i.e. not highlighted yet) trailingws and we begin selecting text, don't highlight the trailingws until we are done with selection, even if we moved the cursor to another line while selecting. --- internal/action/bufpane.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/action/bufpane.go b/internal/action/bufpane.go index 89d174c7..2baf6739 100644 --- a/internal/action/bufpane.go +++ b/internal/action/bufpane.go @@ -512,7 +512,8 @@ func (h *BufPane) HandleEvent(event tcell.Event) { cursors := h.Buf.GetCursors() for _, c := range cursors { - if c.NewTrailingWsY != c.Y { + if c.NewTrailingWsY != c.Y && (!c.HasSelection() || + (c.NewTrailingWsY != c.CurSelection[0].Y && c.NewTrailingWsY != c.CurSelection[1].Y)) { c.NewTrailingWsY = -1 } }