implement equivalent of vi's 'e' command
This commit is contained in:
@@ -149,6 +149,22 @@ struct
|
||||
(newApp, drawMsg)
|
||||
end
|
||||
|
||||
fun endOfWord (app: app_type) =
|
||||
let
|
||||
val {buffer, windowWidth, windowHeight, startLine, cursorIdx, ...} = app
|
||||
|
||||
val buffer = LineGap.goToIdx (cursorIdx, buffer)
|
||||
val cursorIdx = Cursor.endOfWord (buffer, cursorIdx)
|
||||
|
||||
val buffer = LineGap.goToLine (startLine, buffer)
|
||||
val drawMsg = TextBuilder.build
|
||||
(startLine, cursorIdx, buffer, windowWidth, windowHeight)
|
||||
|
||||
val newApp = AppWith.bufferAndCursorIdx (app, buffer, cursorIdx)
|
||||
in
|
||||
(newApp, drawMsg)
|
||||
end
|
||||
|
||||
fun handleChr (app: app_type, chr) =
|
||||
case chr of
|
||||
#"h" => moveLeft app
|
||||
@@ -159,6 +175,7 @@ struct
|
||||
| #"$" => moveToLineEnd app
|
||||
| #"w" => nextWord app
|
||||
| #"b" => prevWord app
|
||||
| #"e" => endOfWord app
|
||||
| _ => (app, [])
|
||||
|
||||
fun update (app, msg) =
|
||||
|
||||
Reference in New Issue
Block a user