add cursorIdx to app type in fcore
This commit is contained in:
@@ -1,12 +1,18 @@
|
|||||||
structure AppType =
|
structure AppType =
|
||||||
struct
|
struct
|
||||||
type app_type =
|
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 =
|
fun init (buffer, windowWidth, windowHeight) : app_type =
|
||||||
{ buffer = buffer
|
{ buffer = buffer
|
||||||
, windowWidth = windowWidth
|
, windowWidth = windowWidth
|
||||||
, windowHeight = windowHeight
|
, windowHeight = windowHeight
|
||||||
, startLine = 0
|
, startLine = 0
|
||||||
|
, cursorIdx = 0
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -8,10 +8,9 @@ struct
|
|||||||
|
|
||||||
fun resizeText (app: app_type, newWidth, newHeight) =
|
fun resizeText (app: app_type, newWidth, newHeight) =
|
||||||
let
|
let
|
||||||
val {buffer, windowWidth, windowHeight, startLine} = app
|
val {buffer, windowWidth, windowHeight, startLine, cursorIdx} = app
|
||||||
|
|
||||||
val newBuffer = LineGap.goToLine (startLine, buffer)
|
val newBuffer = LineGap.goToLine (startLine, buffer)
|
||||||
val cursorIdx = 0 (* TEMP *)
|
|
||||||
val textVec = TextBuilder.build
|
val textVec = TextBuilder.build
|
||||||
(startLine, cursorIdx, newBuffer, newWidth, newHeight)
|
(startLine, cursorIdx, newBuffer, newWidth, newHeight)
|
||||||
|
|
||||||
|
|||||||
@@ -4,12 +4,14 @@ struct
|
|||||||
|
|
||||||
fun bufferAndSize (app: app_type, newBuffer, newWidth, newHeight) =
|
fun bufferAndSize (app: app_type, newBuffer, newWidth, newHeight) =
|
||||||
let
|
let
|
||||||
val {buffer = _, windowWidth = _, windowHeight = _, startLine} = app
|
val {buffer = _, windowWidth = _, windowHeight = _, startLine, cursorIdx} =
|
||||||
|
app
|
||||||
in
|
in
|
||||||
{ buffer = newBuffer
|
{ buffer = newBuffer
|
||||||
, windowWidth = newWidth
|
, windowWidth = newWidth
|
||||||
, windowHeight = newHeight
|
, windowHeight = newHeight
|
||||||
, startLine = startLine
|
, startLine = startLine
|
||||||
|
, cursorIdx = cursorIdx
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user