mirror of
https://github.com/zyedidia/micro.git
synced 2026-02-05 06:30:28 +09:00
Implemented SkipMultiCursorBack as a counterpart to SkipMultiCursor (#3404)
This commit is contained in:
@@ -2167,14 +2167,16 @@ func (h *BufPane) MouseMultiCursor(e *tcell.EventMouse) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// SkipMultiCursor moves the current multiple cursor to the next available position
|
||||
func (h *BufPane) SkipMultiCursor() bool {
|
||||
func (h *BufPane) skipMultiCursor(forward bool) bool {
|
||||
lastC := h.Buf.GetCursor(h.Buf.NumCursors() - 1)
|
||||
if !lastC.HasSelection() {
|
||||
return false
|
||||
}
|
||||
sel := lastC.GetSelection()
|
||||
searchStart := lastC.CurSelection[1]
|
||||
if !forward {
|
||||
searchStart = lastC.CurSelection[0]
|
||||
}
|
||||
|
||||
search := string(sel)
|
||||
search = regexp.QuoteMeta(search)
|
||||
@@ -2182,7 +2184,7 @@ func (h *BufPane) SkipMultiCursor() bool {
|
||||
search = "\\b" + search + "\\b"
|
||||
}
|
||||
|
||||
match, found, err := h.Buf.FindNext(search, h.Buf.Start(), h.Buf.End(), searchStart, true, true)
|
||||
match, found, err := h.Buf.FindNext(search, h.Buf.Start(), h.Buf.End(), searchStart, forward, true)
|
||||
if err != nil {
|
||||
InfoBar.Error(err)
|
||||
}
|
||||
@@ -2202,6 +2204,16 @@ func (h *BufPane) SkipMultiCursor() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// SkipMultiCursor moves the current multiple cursor to the next available position
|
||||
func (h *BufPane) SkipMultiCursor() bool {
|
||||
return h.skipMultiCursor(true)
|
||||
}
|
||||
|
||||
// SkipMultiCursorBack moves the current multiple cursor to the previous available position
|
||||
func (h *BufPane) SkipMultiCursorBack() bool {
|
||||
return h.skipMultiCursor(false)
|
||||
}
|
||||
|
||||
// RemoveMultiCursor removes the latest multiple cursor
|
||||
func (h *BufPane) RemoveMultiCursor() bool {
|
||||
if h.Buf.NumCursors() > 1 {
|
||||
|
||||
@@ -851,6 +851,7 @@ var BufKeyActions = map[string]BufKeyAction{
|
||||
"RemoveMultiCursor": (*BufPane).RemoveMultiCursor,
|
||||
"RemoveAllMultiCursors": (*BufPane).RemoveAllMultiCursors,
|
||||
"SkipMultiCursor": (*BufPane).SkipMultiCursor,
|
||||
"SkipMultiCursorBack": (*BufPane).SkipMultiCursorBack,
|
||||
"JumpToMatchingBrace": (*BufPane).JumpToMatchingBrace,
|
||||
"JumpLine": (*BufPane).JumpLine,
|
||||
"Deselect": (*BufPane).Deselect,
|
||||
|
||||
@@ -274,6 +274,7 @@ SpawnMultiCursorSelect
|
||||
RemoveMultiCursor
|
||||
RemoveAllMultiCursors
|
||||
SkipMultiCursor
|
||||
SkipMultiCursorBack
|
||||
None
|
||||
JumpToMatchingBrace
|
||||
Autocomplete
|
||||
|
||||
Reference in New Issue
Block a user