(forward bool)
| 2268 | } |
| 2269 | |
| 2270 | func (h *BufPane) skipMultiCursor(forward bool) bool { |
| 2271 | lastC := h.Buf.GetCursor(h.Buf.NumCursors() - 1) |
| 2272 | if !lastC.HasSelection() { |
| 2273 | return false |
| 2274 | } |
| 2275 | sel := lastC.GetSelection() |
| 2276 | searchStart := lastC.CurSelection[1] |
| 2277 | if !forward { |
| 2278 | searchStart = lastC.CurSelection[0] |
| 2279 | } |
| 2280 | |
| 2281 | search := string(sel) |
| 2282 | search = regexp.QuoteMeta(search) |
| 2283 | if h.multiWord { |
| 2284 | search = "\\b" + search + "\\b" |
| 2285 | } |
| 2286 | |
| 2287 | match, found, err := h.Buf.FindNext(search, h.Buf.Start(), h.Buf.End(), searchStart, forward, true) |
| 2288 | if err != nil { |
| 2289 | InfoBar.Error(err) |
| 2290 | } |
| 2291 | if found { |
| 2292 | lastC.SetSelectionStart(match[0]) |
| 2293 | lastC.SetSelectionEnd(match[1]) |
| 2294 | lastC.OrigSelection[0] = lastC.CurSelection[0] |
| 2295 | lastC.OrigSelection[1] = lastC.CurSelection[1] |
| 2296 | lastC.Loc = lastC.CurSelection[1] |
| 2297 | |
| 2298 | h.Buf.MergeCursors() |
| 2299 | h.Buf.SetCurCursor(h.Buf.NumCursors() - 1) |
| 2300 | } else { |
| 2301 | InfoBar.Message("No matches found") |
| 2302 | } |
| 2303 | h.Relocate() |
| 2304 | return true |
| 2305 | } |
| 2306 | |
| 2307 | // SkipMultiCursor moves the current multiple cursor to the next available position |
| 2308 | func (h *BufPane) SkipMultiCursor() bool { |
no test coverage detected