repace usage of 'Cursor.toNextChr' with 'Cursor.toNextChrNew' ins make-normal-delete.sml
This commit is contained in:
@@ -148,7 +148,9 @@ struct
|
||||
end
|
||||
else
|
||||
let
|
||||
val newCursorIdx = Cursor.toNextChr (buffer, cursorIdx, #"\n")
|
||||
val newCursorIdx =
|
||||
Cursor.toNextChrNew
|
||||
(buffer, cursorIdx, {findChr = #"\n", count = 1})
|
||||
in
|
||||
if newCursorIdx >= #textLength buffer - 2 then
|
||||
finishAfterDeletingBuffer (app, cursorIdx, buffer, time, [])
|
||||
@@ -178,7 +180,9 @@ struct
|
||||
else
|
||||
let
|
||||
val buffer = LineGap.goToIdx (cursorIdx, buffer)
|
||||
val newCursorIdx = Cursor.toNextChr (buffer, cursorIdx, #"\n")
|
||||
val newCursorIdx =
|
||||
Cursor.toNextChrNew
|
||||
(buffer, cursorIdx, {findChr = #"\n", count = 1})
|
||||
val buffer = LineGap.goToIdx (newCursorIdx, buffer)
|
||||
in
|
||||
if
|
||||
@@ -976,7 +980,7 @@ struct
|
||||
val start = Int.max (cursorIdx - 1, 0)
|
||||
val buffer = LineGap.goToIdx (start, buffer)
|
||||
|
||||
val high = Cursor.toNextChr (buffer, start, chr)
|
||||
val high = Cursor.toNextChrNew (buffer, start, {findChr = chr, count = 1})
|
||||
val buffer = LineGap.goToIdx (high, buffer)
|
||||
val origLow = Cursor.matchPair (buffer, high)
|
||||
in
|
||||
@@ -1020,7 +1024,7 @@ struct
|
||||
val start = Int.max (cursorIdx - 1, 0)
|
||||
val buffer = LineGap.goToIdx (start, buffer)
|
||||
|
||||
val high = Cursor.toNextChr (buffer, start, chr)
|
||||
val high = Cursor.toNextChrNew (buffer, start, {findChr = chr, count = 1})
|
||||
val buffer = LineGap.goToIdx (high, buffer)
|
||||
val low = Cursor.matchPair (buffer, high)
|
||||
in
|
||||
|
||||
@@ -343,8 +343,8 @@ struct
|
||||
fun parseDeleteTerminal (str, count, app, chrCmd, time) =
|
||||
case chrCmd of
|
||||
(* terminal commands: require no input after *)
|
||||
#"h" => NormalYankDelete.deleteByDfa (app, count, Cursor.viH, time)
|
||||
| #"l" => NormalYankDelete.deleteByDfa (app, count, Cursor.viL, time)
|
||||
#"h" => NormalYankDelete.deleteCharsLeft (app, count, time)
|
||||
| #"l" => NormalYankDelete.removeChr (app, count, time)
|
||||
(* vi's 'j' and 'k' commands move up or down a column
|
||||
* but 'dj' or 'dk' delete whole lines
|
||||
* so their implementation differs from
|
||||
@@ -368,6 +368,7 @@ struct
|
||||
| #"n" => NormalYankDelete.deleteToNextMatch (app, count, time)
|
||||
| #"N" => NormalYankDelete.deleteToPrevMatch (app, count, time)
|
||||
| #"%" => NormalYankDelete.deletePair (app, time)
|
||||
| #"G" => NormalYankDelete.deleteToEnd (app, time)
|
||||
(* non-terminal commands which require appending chr *)
|
||||
| #"t" => appendChr (app, chrCmd, str)
|
||||
| #"T" => appendChr (app, chrCmd, str)
|
||||
@@ -392,15 +393,11 @@ struct
|
||||
else
|
||||
(* have to continue parsing string *)
|
||||
case String.sub (str, strPos + 1) of
|
||||
#"t" =>
|
||||
NormalYankDelete.deleteToChr
|
||||
(app, 1, Cursor.tillNextChr, op+, chrCmd, time)
|
||||
#"t" => NormalYankDelete.deleteTillNextChr (app, count, chrCmd, time)
|
||||
| #"T" =>
|
||||
NormalYankDelete.deleteToChr
|
||||
(app, 1, Cursor.tillPrevChr, op-, chrCmd, time)
|
||||
| #"f" =>
|
||||
NormalYankDelete.deleteToChr
|
||||
(app, count, Cursor.toNextChr, op+, chrCmd, time)
|
||||
| #"f" => NormalYankDelete.deleteToNextChr (app, count, chrCmd, time)
|
||||
| #"F" =>
|
||||
NormalYankDelete.deleteToChr
|
||||
(app, count, Cursor.toPrevChr, op-, chrCmd, time)
|
||||
|
||||
Reference in New Issue
Block a user