Skip to content

Commit fc5d83f

Browse files
committed
Improve RemoveMultiCursor & RemoveAllMultiCursors actions return values
1 parent 781f057 commit fc5d83f

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

internal/action/actions.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2023,17 +2023,23 @@ func (h *BufPane) RemoveMultiCursor() bool {
20232023
h.Buf.RemoveCursor(h.Buf.NumCursors() - 1)
20242024
h.Buf.SetCurCursor(h.Buf.NumCursors() - 1)
20252025
h.Buf.UpdateCursors()
2026-
} else {
2026+
} else if h.multiWord {
20272027
h.multiWord = false
2028+
} else {
2029+
return false
20282030
}
20292031
h.Relocate()
20302032
return true
20312033
}
20322034

20332035
// RemoveAllMultiCursors removes all cursors except the base cursor
20342036
func (h *BufPane) RemoveAllMultiCursors() bool {
2035-
h.Buf.ClearCursors()
2036-
h.multiWord = false
2037+
if h.Buf.NumCursors() > 1 || h.multiWord {
2038+
h.Buf.ClearCursors()
2039+
h.multiWord = false
2040+
} else {
2041+
return false
2042+
}
20372043
h.Relocate()
20382044
return true
20392045
}

0 commit comments

Comments
 (0)