diff --git a/fcore/normal-mode/normal-mode.sml b/fcore/normal-mode/normal-mode.sml index 8581198..e0f98b9 100644 --- a/fcore/normal-mode/normal-mode.sml +++ b/fcore/normal-mode/normal-mode.sml @@ -565,7 +565,7 @@ struct * tillNextChr with count of 1 has same effect * as tillNextChr with any count above 1 * so just hardcode 1 *) - parseMoveToChr (1, app, Cursor.tillNextChr, chrCmd) + NormalMove.tillNextChr (app, count, chrCmd) | #"T" => (* to just before chr, backward *) parseMoveToChr (1, app, Cursor.tillPrevChr, chrCmd) diff --git a/fcore/normal-mode/normal-move.sml b/fcore/normal-mode/normal-move.sml index f14f081..2c064e0 100644 --- a/fcore/normal-mode/normal-move.sml +++ b/fcore/normal-mode/normal-move.sml @@ -530,4 +530,18 @@ struct NormalFinish.buildTextAndClear (app, buffer, newCursorIdx, searchList, [], bufferModifyTime) end + + fun tillNextChr (app: app_type, count, chr) = + let + val {cursorIdx, buffer, searchList, bufferModifyTime, ...} = app + val buffer = LineGap.goToIdx (cursorIdx, buffer) + val newCursorIdx = + Cursor.toNextChrNew (buffer, cursorIdx, {findChr = chr, count = count}) + in + if newCursorIdx = ~1 then + NormalFinish.clearMode app + else + NormalFinish.buildTextAndClear + (app, buffer, newCursorIdx - 1, searchList, [], bufferModifyTime) + end end