add implementation of viK, completing hjkl movement keys
This commit is contained in:
@@ -69,10 +69,27 @@ struct
|
||||
(newApp, drawMsg)
|
||||
end
|
||||
|
||||
fun moveUp (app: app_type) =
|
||||
let
|
||||
val {buffer, windowWidth, windowHeight, startLine, cursorIdx, ...} = app
|
||||
|
||||
val buffer = LineGap.goToIdx (cursorIdx, buffer)
|
||||
val cursorIdx = Cursor.viK (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
|
||||
| #"j" => moveDown app
|
||||
| #"k" => moveUp app
|
||||
| #"l" => moveRight app
|
||||
| _ => (app, [])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user