reimplement 'f' move motion more efficiently, not leaving the LineGap.t data structure while iterating to next count
This commit is contained in:
@@ -571,9 +571,7 @@ struct
|
||||
parseMoveToChr (1, app, Cursor.tillPrevChr, chrCmd)
|
||||
| #"y" => ParseYank.parseYank (strPos, str, count, app, chrCmd, time)
|
||||
| #"d" => ParseDelete.parseDelete (strPos, str, count, app, chrCmd, time)
|
||||
| #"f" =>
|
||||
(* to chr, forward *)
|
||||
parseMoveToChr (count, app, Cursor.toNextChr, chrCmd)
|
||||
| #"f" => (* to chr, forward *) NormalMove.toNextChr (app, count, chrCmd)
|
||||
| #"F" =>
|
||||
(* to chr, backward *)
|
||||
parseMoveToChr (count, app, Cursor.toPrevChr, chrCmd)
|
||||
|
||||
@@ -516,4 +516,18 @@ struct
|
||||
NormalFinish.buildTextAndClear
|
||||
(app, buffer, newCursorIdx, searchList, [], bufferModifyTime)
|
||||
end
|
||||
|
||||
fun toNextChr (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, searchList, [], bufferModifyTime)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user