reimplement 'dt' motion

This commit is contained in:
2025-10-18 14:59:37 +01:00
parent bc44c7bcd0
commit d7adae374f
3 changed files with 18 additions and 5 deletions

View File

@@ -740,6 +740,21 @@ struct
end
end
fun deleteTillNextChr (app: app_type, count, chr, time) =
let
val {buffer, cursorIdx, ...} = 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
let val length = newCursorIdx - cursorIdx
in deleteAndFinish (app, cursorIdx, length, buffer, time)
end
end
fun deleteToStart (app: app_type, time) : AppType.app_type =
let
val {cursorIdx, buffer, windowWidth, windowHeight, dfa, ...} = app

View File

@@ -298,9 +298,7 @@ struct
else
(* have to continue parsing string *)
case String.sub (str, strPos + 1) of
#"t" =>
NormalDelete.deleteToChr
(app, 1, Cursor.tillNextChr, op+, chrCmd, time)
#"t" => NormalDelete.deleteTillNextChr (app, count, chrCmd, time)
| #"T" =>
NormalDelete.deleteToChr
(app, 1, Cursor.tillPrevChr, op-, chrCmd, time)