add command to go to start of lineGap

This commit is contained in:
2024-10-30 07:51:24 +00:00
parent c7570707ab
commit f2f305c35d
2 changed files with 20 additions and 0 deletions

View File

@@ -19,6 +19,25 @@ struct
(newApp, drawMsg) (newApp, drawMsg)
end end
fun moveToStart (app: app_type) =
let
val {buffer, windowWidth, windowHeight, startLine, ...} = app
val cursorIdx = 0
val startLine = 0
val buffer = LineGap.goToIdx (cursorIdx, buffer)
val drawMsg =
TextBuilder.build
(startLine, cursorIdx, buffer, windowWidth, windowHeight)
val mode = NORMAL_MODE ""
val newApp = AppWith.bufferAndCursorIdx
(app, buffer, cursorIdx, mode, startLine)
in
(newApp, drawMsg)
end
fun helpMove (app: app_type, buffer, cursorIdx, count, fMove) = fun helpMove (app: app_type, buffer, cursorIdx, count, fMove) =
if count = 0 then if count = 0 then
let let
@@ -221,6 +240,7 @@ struct
(case chr of (case chr of
#"e" => move (app, count, Cursor.endOfPrevWord) #"e" => move (app, count, Cursor.endOfPrevWord)
| #"E" => move (app, count, Cursor.endOfPrevWORD) | #"E" => move (app, count, Cursor.endOfPrevWORD)
| #"g" => moveToStart app
| _ => clearMode app) | _ => clearMode app)
| RESIZE_EVENT (width, height) => resizeText (app, width, height) | RESIZE_EVENT (width, height) => resizeText (app, width, height)

BIN
shf

Binary file not shown.