add cursorIdx to app type in fcore

This commit is contained in:
2024-10-09 10:59:32 +01:00
parent cfaa66bc0b
commit 418adc4502
4 changed files with 11 additions and 4 deletions

View File

@@ -1,12 +1,18 @@
structure AppType =
struct
type app_type =
{buffer: LineGap.t, windowWidth: int, windowHeight: int, startLine: int}
{ buffer: LineGap.t
, windowWidth: int
, windowHeight: int
, startLine: int
, cursorIdx: int
}
fun init (buffer, windowWidth, windowHeight) : app_type =
{ buffer = buffer
, windowWidth = windowWidth
, windowHeight = windowHeight
, startLine = 0
, cursorIdx = 0
}
end

View File

@@ -8,10 +8,9 @@ struct
fun resizeText (app: app_type, newWidth, newHeight) =
let
val {buffer, windowWidth, windowHeight, startLine} = app
val {buffer, windowWidth, windowHeight, startLine, cursorIdx} = app
val newBuffer = LineGap.goToLine (startLine, buffer)
val cursorIdx = 0 (* TEMP *)
val textVec = TextBuilder.build
(startLine, cursorIdx, newBuffer, newWidth, newHeight)

View File

@@ -4,12 +4,14 @@ struct
fun bufferAndSize (app: app_type, newBuffer, newWidth, newHeight) =
let
val {buffer = _, windowWidth = _, windowHeight = _, startLine} = app
val {buffer = _, windowWidth = _, windowHeight = _, startLine, cursorIdx} =
app
in
{ buffer = newBuffer
, windowWidth = newWidth
, windowHeight = newHeight
, startLine = startLine
, cursorIdx = cursorIdx
}
end
end

BIN
shf

Binary file not shown.