add visualScrollColumn' field to app type, which will record the scroll position for us

This commit is contained in:
2025-09-11 15:26:30 +01:00
parent 5e7f311dc7
commit e85ac5e806
3 changed files with 21 additions and 0 deletions

View File

@@ -17,6 +17,8 @@ struct
, startLine: int , startLine: int
(* absolute index of movable cursor *) (* absolute index of movable cursor *)
, cursorIdx: int , cursorIdx: int
(* column to start drawing text at for horizontal scrolling. *)
, visualScrollColumn: int
(* msgs to send after an update. (* msgs to send after an update.
* The list of messages is reset on each invocation of AppUpdate.update. *) * The list of messages is reset on each invocation of AppUpdate.update. *)
, msgs: MailboxType.t list , msgs: MailboxType.t list
@@ -32,6 +34,7 @@ struct
, windowHeight = windowHeight , windowHeight = windowHeight
, startLine = 0 , startLine = 0
, cursorIdx = 0 , cursorIdx = 0
, visualScrollColumn = 0
, msgs = [] , msgs = []
} }
end end

View File

@@ -23,6 +23,7 @@ struct
, searchString , searchString
, startLine , startLine
, cursorIdx , cursorIdx
, visualScrollColumn
} = app } = app
in in
{ mode = mode { mode = mode
@@ -35,6 +36,7 @@ struct
, searchString = searchString , searchString = searchString
, startLine = startLine , startLine = startLine
, cursorIdx = cursorIdx , cursorIdx = cursorIdx
, visualScrollColumn = visualScrollColumn
} }
end end
@@ -60,6 +62,7 @@ struct
, searchString , searchString
, windowWidth , windowWidth
, windowHeight , windowHeight
, visualScrollColumn
} = app } = app
in in
{ mode = newMode { mode = newMode
@@ -72,6 +75,7 @@ struct
, searchString = searchString , searchString = searchString
, windowWidth = windowWidth , windowWidth = windowWidth
, windowHeight = windowHeight , windowHeight = windowHeight
, visualScrollColumn = visualScrollColumn
} }
end end
@@ -88,6 +92,7 @@ struct
, windowWidth , windowWidth
, windowHeight , windowHeight
, startLine , startLine
, visualScrollColumn
} = app } = app
in in
{ mode = newMode { mode = newMode
@@ -100,6 +105,7 @@ struct
, windowWidth = windowWidth , windowWidth = windowWidth
, windowHeight = windowHeight , windowHeight = windowHeight
, startLine = startLine , startLine = startLine
, visualScrollColumn = visualScrollColumn
} }
end end
@@ -116,6 +122,7 @@ struct
, windowWidth , windowWidth
, windowHeight , windowHeight
, startLine , startLine
, visualScrollColumn
} = app } = app
in in
{ mode = newMode { mode = newMode
@@ -128,6 +135,7 @@ struct
, windowWidth = windowWidth , windowWidth = windowWidth
, windowHeight = windowHeight , windowHeight = windowHeight
, startLine = startLine , startLine = startLine
, visualScrollColumn = visualScrollColumn
} }
end end
@@ -151,6 +159,7 @@ struct
, windowWidth , windowWidth
, windowHeight , windowHeight
, startLine , startLine
, visualScrollColumn
} = app } = app
in in
{ searchList = newSearchList { searchList = newSearchList
@@ -163,6 +172,7 @@ struct
, windowWidth = windowWidth , windowWidth = windowWidth
, windowHeight = windowHeight , windowHeight = windowHeight
, startLine = startLine , startLine = startLine
, visualScrollColumn = visualScrollColumn
} }
end end
end end

View File

@@ -23,6 +23,7 @@ struct
, windowWidth , windowWidth
, windowHeight , windowHeight
, cursorIdx , cursorIdx
, visualScrollColumn
} = app } = app
in in
{ mode = newMode { mode = newMode
@@ -35,6 +36,7 @@ struct
, windowWidth = windowWidth , windowWidth = windowWidth
, windowHeight = windowHeight , windowHeight = windowHeight
, cursorIdx = cursorIdx , cursorIdx = cursorIdx
, visualScrollColumn = visualScrollColumn
} }
end end
@@ -52,6 +54,7 @@ struct
, windowWidth , windowWidth
, windowHeight , windowHeight
, cursorIdx , cursorIdx
, visualScrollColumn
} = app } = app
in in
{ mode = newMode { mode = newMode
@@ -64,6 +67,7 @@ struct
, windowWidth = windowWidth , windowWidth = windowWidth
, windowHeight = windowHeight , windowHeight = windowHeight
, cursorIdx = cursorIdx , cursorIdx = cursorIdx
, visualScrollColumn = visualScrollColumn
} }
end end
@@ -80,6 +84,7 @@ struct
, windowWidth , windowWidth
, windowHeight , windowHeight
, cursorIdx , cursorIdx
, visualScrollColumn
} = app } = app
in in
{ mode = mode { mode = mode
@@ -92,6 +97,7 @@ struct
, windowWidth = windowWidth , windowWidth = windowWidth
, windowHeight = windowHeight , windowHeight = windowHeight
, cursorIdx = cursorIdx , cursorIdx = cursorIdx
, visualScrollColumn = visualScrollColumn
} }
end end
@@ -109,6 +115,7 @@ struct
, startLine , startLine
, bufferModifyTime , bufferModifyTime
, cursorIdx , cursorIdx
, visualScrollColumn
} = app } = app
in in
{ mode = mode { mode = mode
@@ -121,6 +128,7 @@ struct
, searchString = searchString , searchString = searchString
, bufferModifyTime = bufferModifyTime , bufferModifyTime = bufferModifyTime
, cursorIdx = cursorIdx , cursorIdx = cursorIdx
, visualScrollColumn = visualScrollColumn
} }
end end
end end