add indent-line functionality
This commit is contained in:
@@ -106,13 +106,7 @@ struct
|
|||||||
* Instead, a single character is deleted at different places.
|
* Instead, a single character is deleted at different places.
|
||||||
* So it doesn't make any sense to use Fn.initMsgs
|
* So it doesn't make any sense to use Fn.initMsgs
|
||||||
* which expects a range. *)
|
* which expects a range. *)
|
||||||
let
|
finishAfterDeletingBuffer (app, cursorIdx, buffer, time, [])
|
||||||
val buffer = LineGap.goToStart buffer
|
|
||||||
val searchString = #searchString app
|
|
||||||
val initialMsg = [SEARCH (buffer, searchString)]
|
|
||||||
in
|
|
||||||
finishAfterDeletingBuffer (app, cursorIdx, buffer, time, initialMsg)
|
|
||||||
end
|
|
||||||
else
|
else
|
||||||
let
|
let
|
||||||
val buffer = LineGap.goToIdx (cursorIdx, buffer)
|
val buffer = LineGap.goToIdx (cursorIdx, buffer)
|
||||||
|
|||||||
@@ -25,6 +25,26 @@ struct
|
|||||||
NormalModeWith.mode (app, mode, [])
|
NormalModeWith.mode (app, mode, [])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
fun makeSpace _ = #" "
|
||||||
|
|
||||||
|
fun indnetLine (app: app_type, count, time) =
|
||||||
|
let
|
||||||
|
open MailboxType
|
||||||
|
|
||||||
|
val {cursorIdx, buffer, searchString, ...} = app
|
||||||
|
val buffer = LineGap.goToIdx (cursorIdx, buffer)
|
||||||
|
val lineStart = Cursor.vi0 (buffer, cursorIdx)
|
||||||
|
|
||||||
|
val indentString = CharVector.tabulate (count * 2, makeSpace)
|
||||||
|
val buffer = LineGap.insert (lineStart, indentString, buffer)
|
||||||
|
|
||||||
|
val buffer = LineGap.goToStart buffer
|
||||||
|
val initialMsg = [SEARCH (buffer, searchString)]
|
||||||
|
in
|
||||||
|
NormalDelete.finishAfterDeletingBuffer
|
||||||
|
(app, cursorIdx, buffer, time, initialMsg)
|
||||||
|
end
|
||||||
|
|
||||||
fun parseMoveToChr (count, app, fMove, chrCmd) =
|
fun parseMoveToChr (count, app, fMove, chrCmd) =
|
||||||
NormalMove.moveToChr (app, count, fMove, chrCmd)
|
NormalMove.moveToChr (app, count, fMove, chrCmd)
|
||||||
|
|
||||||
@@ -88,6 +108,7 @@ struct
|
|||||||
| #"x" => NormalDelete.removeChr (app, count, time)
|
| #"x" => NormalDelete.removeChr (app, count, time)
|
||||||
| #"J" => NormalDelete.removeLineBreaks (app, count, time)
|
| #"J" => NormalDelete.removeLineBreaks (app, count, time)
|
||||||
| #"/" => switchToNormalSearchMode app
|
| #"/" => switchToNormalSearchMode app
|
||||||
|
| #">" => indnetLine (app, count, time)
|
||||||
(* multi-char commands which can be appended *)
|
(* multi-char commands which can be appended *)
|
||||||
| #"t" => appendChr (app, chr, str)
|
| #"t" => appendChr (app, chr, str)
|
||||||
| #"T" => appendChr (app, chr, str)
|
| #"T" => appendChr (app, chr, str)
|
||||||
|
|||||||
Reference in New Issue
Block a user