From 2793c37a94e390f7972ffed322aad38a7ccf94c7 Mon Sep 17 00:00:00 2001 From: Dmytro Maluka Date: Sat, 15 Jun 2024 20:32:16 +0200 Subject: [PATCH] Fix SkipMultiCursor behavior when there is no selection When there is no selection (i.e. selection is empty), SkipMultiCursor searches for the empty text, "finds" it as the beginning of the buffer, and as a result, jumps to the beginning of the buffer, which confuses the user. Fix it. --- internal/action/actions.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/internal/action/actions.go b/internal/action/actions.go index 3806b348..a4d6fdea 100644 --- a/internal/action/actions.go +++ b/internal/action/actions.go @@ -2013,6 +2013,9 @@ func (h *BufPane) MouseMultiCursor(e *tcell.EventMouse) bool { // SkipMultiCursor moves the current multiple cursor to the next available position func (h *BufPane) SkipMultiCursor() bool { lastC := h.Buf.GetCursor(h.Buf.NumCursors() - 1) + if !lastC.HasSelection() { + return false + } sel := lastC.GetSelection() searchStart := lastC.CurSelection[1]