progress with viJ to move cursor downwards
This commit is contained in:
@@ -26,15 +26,13 @@ struct
|
||||
(* move LineGap to cursorIdx, which is necessary for finding newCursorIdx *)
|
||||
val buffer = LineGap.goToIdx (cursorIdx, buffer)
|
||||
val cursorIdx = Cursor.viL (buffer, cursorIdx)
|
||||
val preferredColumn = Cursor.getCursorColumn (buffer, cursorIdx)
|
||||
|
||||
(* move LineGap to first line displayed on screen, and build new text *)
|
||||
val buffer = LineGap.goToLine (startLine, buffer)
|
||||
val drawMsg = TextBuilder.build
|
||||
(startLine, cursorIdx, buffer, windowWidth, windowHeight)
|
||||
|
||||
val newApp =
|
||||
AppWith.bufferAndCursorIdx (app, buffer, cursorIdx, preferredColumn)
|
||||
val newApp = AppWith.bufferAndCursorIdx (app, buffer, cursorIdx)
|
||||
in
|
||||
(newApp, drawMsg)
|
||||
end
|
||||
@@ -45,14 +43,28 @@ struct
|
||||
|
||||
val buffer = LineGap.goToIdx (cursorIdx, buffer)
|
||||
val cursorIdx = Cursor.viH (buffer, cursorIdx)
|
||||
val preferredColumn = Cursor.getCursorColumn (buffer, cursorIdx)
|
||||
|
||||
val buffer = LineGap.goToLine (startLine, buffer)
|
||||
val drawMsg = TextBuilder.build
|
||||
(startLine, cursorIdx, buffer, windowWidth, windowHeight)
|
||||
|
||||
val newApp =
|
||||
AppWith.bufferAndCursorIdx (app, buffer, cursorIdx, preferredColumn)
|
||||
val newApp = AppWith.bufferAndCursorIdx (app, buffer, cursorIdx)
|
||||
in
|
||||
(newApp, drawMsg)
|
||||
end
|
||||
|
||||
fun moveDown (app: app_type) =
|
||||
let
|
||||
val {buffer, windowWidth, windowHeight, startLine, cursorIdx, ...} = app
|
||||
|
||||
val buffer = LineGap.goToIdx (cursorIdx, buffer)
|
||||
val cursorIdx = Cursor.viJ (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
|
||||
@@ -60,6 +72,7 @@ struct
|
||||
fun handleChr (app: app_type, chr) =
|
||||
case chr of
|
||||
#"h" => moveLeft app
|
||||
| #"j" => moveDown app
|
||||
| #"l" => moveRight app
|
||||
| _ => (app, [])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user