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.
This commit is contained in:
Dmitry Maluka 2020-10-22 22:54:46 +02:00 committed by Dmytro Maluka
parent f108c90643
commit 53efce72fa

View File

@ -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
}
}