remove 'Cursor.tillPrevChr', replacing usages of that function with 'Cursor.toPrevChr'

This commit is contained in:
2025-10-19 14:30:26 +01:00
parent 60ec24453f
commit 7d1272180b
5 changed files with 130 additions and 274 deletions

View File

@@ -544,4 +544,32 @@ struct
NormalFinish.buildTextAndClear
(app, buffer, newCursorIdx - 1, searchList, [], bufferModifyTime)
end
fun toPrevChr (app: app_type, count, chr) =
let
val {cursorIdx, buffer, searchList, bufferModifyTime, ...} = app
val buffer = LineGap.goToIdx (cursorIdx, buffer)
val newCursorIdx =
Cursor.toPrevChr (buffer, cursorIdx, {findChr = chr, count = count})
in
if newCursorIdx = ~1 then
NormalFinish.clearMode app
else
NormalFinish.buildTextAndClear
(app, buffer, newCursorIdx, searchList, [], bufferModifyTime)
end
fun tillPrevChr (app: app_type, count, chr) =
let
val {cursorIdx, buffer, searchList, bufferModifyTime, ...} = app
val buffer = LineGap.goToIdx (cursorIdx, buffer)
val newCursorIdx =
Cursor.toPrevChr (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