add two additional terminal yank operations: '<count-y-n> for copying to next match, and <count-y-N> for copying to prev match

This commit is contained in:
2025-09-02 11:48:14 +01:00
parent a90cdf7943
commit 44441ad26b

View File

@@ -342,7 +342,50 @@ struct
NormalModeWith.modeAndBuffer (app, buffer, mode, [DRAW msg])
end
end
(* todo: non-terminal chars, 'n' (go to next match) *)
| #"n" =>
let
open DrawMsg
open MailboxType
val {cursorIdx, searchList, buffer, ...} = app
val high = SearchList.nextMatch (cursorIdx, searchList, count)
in
if high = ~1 orelse high <= cursorIdx then
NormalFinish.clearMode app
else
let
val length = high - cursorIdx
val buffer = LineGap.goToIdx (high, buffer)
val str = LineGap.substring (cursorIdx, length, buffer)
val msg = YANK str
val mode = NORMAL_MODE ""
in
NormalModeWith.modeAndBuffer (app, buffer, mode, [DRAW msg])
end
end
| #"N" =>
let
open DrawMsg
open MailboxType
val {cursorIdx, searchList, buffer, ...} = app
val low = SearchList.prevMatch (cursorIdx, searchList, count)
in
if low = ~1 orelse low >= cursorIdx then
NormalFinish.clearMode app
else
let
val length = cursorIdx - low
val str = LineGap.substring (low, length, buffer)
val msg = YANK str
val mode = NORMAL_MODE ""
in
NormalModeWith.modeAndBuffer (app, buffer, mode, [DRAW msg])
end
end
(* todo: non-terminal chars *)
| _ => NormalFinish.clearMode app
fun parseYank (strPos, str, count, app, chrCmd, time) =