reimplement 'yt<char>' motion to use 'Cursor.toNextChr'
This commit is contained in:
@@ -529,7 +529,7 @@ struct
|
|||||||
parseYankTerminal (str, count, app, chrCmd, time)
|
parseYankTerminal (str, count, app, chrCmd, time)
|
||||||
else
|
else
|
||||||
case String.sub (str, strPos + 1) of
|
case String.sub (str, strPos + 1) of
|
||||||
#"t" => NormalYank.yankToChr (app, 1, Cursor.tillNextChr, op+, chrCmd)
|
#"t" => NormalYank.yankTillNextChr (app, count, chrCmd)
|
||||||
| #"T" => NormalYank.yankToChr (app, 1, Cursor.tillPrevChr, op-, chrCmd)
|
| #"T" => NormalYank.yankToChr (app, 1, Cursor.tillPrevChr, op-, chrCmd)
|
||||||
| #"f" => NormalYank.yankToNextChr (app, count, chrCmd)
|
| #"f" => NormalYank.yankToNextChr (app, count, chrCmd)
|
||||||
| #"F" =>
|
| #"F" =>
|
||||||
|
|||||||
@@ -251,6 +251,27 @@ struct
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
fun yankTillNextChr (app: app_type, count, chr) =
|
||||||
|
let
|
||||||
|
val {buffer, cursorIdx, ...} = app
|
||||||
|
val buffer = LineGap.goToIdx (cursorIdx, buffer)
|
||||||
|
val newCursorIdx =
|
||||||
|
Cursor.toNextChr (buffer, cursorIdx, {findChr = chr, count = count})
|
||||||
|
in
|
||||||
|
if newCursorIdx = ~1 then
|
||||||
|
NormalFinish.clearMode app
|
||||||
|
else
|
||||||
|
let
|
||||||
|
val length = newCursorIdx - cursorIdx
|
||||||
|
val buffer = LineGap.goToIdx (newCursorIdx, 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
|
||||||
|
|
||||||
fun yankToChr (app: app_type, count, fMove, fInc, chr) =
|
fun yankToChr (app: app_type, count, fMove, fInc, chr) =
|
||||||
helpYankToChr
|
helpYankToChr
|
||||||
( app
|
( app
|
||||||
|
|||||||
Reference in New Issue
Block a user