From ee96419901b4c54ca2699f7c76d6be93d5d03a1a Mon Sep 17 00:00:00 2001 From: Humza Shahid Date: Sat, 18 Oct 2025 15:07:14 +0100 Subject: [PATCH] repace usage of 'Cursor.toNextChr' with 'Cursor.toNextChrNew' ins make-normal-delete.sml --- fcore/normal-mode/make-normal-delete.sml | 12 ++++++++---- fcore/normal-mode/normal-mode.sml | 13 +++++-------- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/fcore/normal-mode/make-normal-delete.sml b/fcore/normal-mode/make-normal-delete.sml index 76a48e3..43142f7 100644 --- a/fcore/normal-mode/make-normal-delete.sml +++ b/fcore/normal-mode/make-normal-delete.sml @@ -148,7 +148,9 @@ struct end else let - val newCursorIdx = Cursor.toNextChr (buffer, cursorIdx, #"\n") + val newCursorIdx = + Cursor.toNextChrNew + (buffer, cursorIdx, {findChr = #"\n", count = 1}) in if newCursorIdx >= #textLength buffer - 2 then finishAfterDeletingBuffer (app, cursorIdx, buffer, time, []) @@ -178,7 +180,9 @@ struct else let val buffer = LineGap.goToIdx (cursorIdx, buffer) - val newCursorIdx = Cursor.toNextChr (buffer, cursorIdx, #"\n") + val newCursorIdx = + Cursor.toNextChrNew + (buffer, cursorIdx, {findChr = #"\n", count = 1}) val buffer = LineGap.goToIdx (newCursorIdx, buffer) in if @@ -976,7 +980,7 @@ struct val start = Int.max (cursorIdx - 1, 0) val buffer = LineGap.goToIdx (start, buffer) - val high = Cursor.toNextChr (buffer, start, chr) + val high = Cursor.toNextChrNew (buffer, start, {findChr = chr, count = 1}) val buffer = LineGap.goToIdx (high, buffer) val origLow = Cursor.matchPair (buffer, high) in @@ -1020,7 +1024,7 @@ struct val start = Int.max (cursorIdx - 1, 0) val buffer = LineGap.goToIdx (start, buffer) - val high = Cursor.toNextChr (buffer, start, chr) + val high = Cursor.toNextChrNew (buffer, start, {findChr = chr, count = 1}) val buffer = LineGap.goToIdx (high, buffer) val low = Cursor.matchPair (buffer, high) in diff --git a/fcore/normal-mode/normal-mode.sml b/fcore/normal-mode/normal-mode.sml index b7b0142..68befdf 100644 --- a/fcore/normal-mode/normal-mode.sml +++ b/fcore/normal-mode/normal-mode.sml @@ -343,8 +343,8 @@ struct fun parseDeleteTerminal (str, count, app, chrCmd, time) = case chrCmd of (* terminal commands: require no input after *) - #"h" => NormalYankDelete.deleteByDfa (app, count, Cursor.viH, time) - | #"l" => NormalYankDelete.deleteByDfa (app, count, Cursor.viL, time) + #"h" => NormalYankDelete.deleteCharsLeft (app, count, time) + | #"l" => NormalYankDelete.removeChr (app, count, time) (* vi's 'j' and 'k' commands move up or down a column * but 'dj' or 'dk' delete whole lines * so their implementation differs from @@ -368,6 +368,7 @@ struct | #"n" => NormalYankDelete.deleteToNextMatch (app, count, time) | #"N" => NormalYankDelete.deleteToPrevMatch (app, count, time) | #"%" => NormalYankDelete.deletePair (app, time) + | #"G" => NormalYankDelete.deleteToEnd (app, time) (* non-terminal commands which require appending chr *) | #"t" => appendChr (app, chrCmd, str) | #"T" => appendChr (app, chrCmd, str) @@ -392,15 +393,11 @@ struct else (* have to continue parsing string *) case String.sub (str, strPos + 1) of - #"t" => - NormalYankDelete.deleteToChr - (app, 1, Cursor.tillNextChr, op+, chrCmd, time) + #"t" => NormalYankDelete.deleteTillNextChr (app, count, chrCmd, time) | #"T" => NormalYankDelete.deleteToChr (app, 1, Cursor.tillPrevChr, op-, chrCmd, time) - | #"f" => - NormalYankDelete.deleteToChr - (app, count, Cursor.toNextChr, op+, chrCmd, time) + | #"f" => NormalYankDelete.deleteToNextChr (app, count, chrCmd, time) | #"F" => NormalYankDelete.deleteToChr (app, count, Cursor.toPrevChr, op-, chrCmd, time)