add mode type to app type (equivalent of vi's normal mode, visual mode, insert mode, etc.)

This commit is contained in:
2024-10-26 04:46:05 +01:00
parent 17a69720fd
commit defb17af20
3 changed files with 42 additions and 9 deletions

View File

@@ -4,10 +4,17 @@ struct
fun bufferAndSize (app: app_type, newBuffer, newWidth, newHeight) =
let
val {buffer = _, windowWidth = _, windowHeight = _, startLine, cursorIdx} =
app
val
{ mode
, buffer = _
, windowWidth = _
, windowHeight = _
, startLine
, cursorIdx
} = app
in
{ buffer = newBuffer
{ mode = mode
, buffer = newBuffer
, windowWidth = newWidth
, windowHeight = newHeight
, startLine = startLine
@@ -17,10 +24,12 @@ struct
fun bufferAndCursorIdx (app: app_type, newBuffer, newCursorIdx) =
let
val {buffer = _, cursorIdx = _, windowWidth, windowHeight, startLine} =
val
{mode, buffer = _, cursorIdx = _, windowWidth, windowHeight, startLine} =
app
in
{ buffer = newBuffer
{ mode = mode
, buffer = newBuffer
, cursorIdx = newCursorIdx
, windowWidth = windowWidth
, windowHeight = windowHeight