From e85ac5e806b824e33a716b1109c39d22bca28263 Mon Sep 17 00:00:00 2001 From: Humza Shahid Date: Thu, 11 Sep 2025 15:26:30 +0100 Subject: [PATCH] add visualScrollColumn' field to app type, which will record the scroll position for us --- fcore/app-type.sml | 3 +++ fcore/normal-mode/normal-mode-with.sml | 10 ++++++++++ fcore/normal-mode/normal-search-mode-with.sml | 8 ++++++++ 3 files changed, 21 insertions(+) diff --git a/fcore/app-type.sml b/fcore/app-type.sml index 290ec54..7f9b251 100644 --- a/fcore/app-type.sml +++ b/fcore/app-type.sml @@ -17,6 +17,8 @@ struct , startLine: int (* absolute index of movable cursor *) , cursorIdx: int + (* column to start drawing text at for horizontal scrolling. *) + , visualScrollColumn: int (* msgs to send after an update. * The list of messages is reset on each invocation of AppUpdate.update. *) , msgs: MailboxType.t list @@ -32,6 +34,7 @@ struct , windowHeight = windowHeight , startLine = 0 , cursorIdx = 0 + , visualScrollColumn = 0 , msgs = [] } end diff --git a/fcore/normal-mode/normal-mode-with.sml b/fcore/normal-mode/normal-mode-with.sml index fd8b9c3..35ccadb 100644 --- a/fcore/normal-mode/normal-mode-with.sml +++ b/fcore/normal-mode/normal-mode-with.sml @@ -23,6 +23,7 @@ struct , searchString , startLine , cursorIdx + , visualScrollColumn } = app in { mode = mode @@ -35,6 +36,7 @@ struct , searchString = searchString , startLine = startLine , cursorIdx = cursorIdx + , visualScrollColumn = visualScrollColumn } end @@ -60,6 +62,7 @@ struct , searchString , windowWidth , windowHeight + , visualScrollColumn } = app in { mode = newMode @@ -72,6 +75,7 @@ struct , searchString = searchString , windowWidth = windowWidth , windowHeight = windowHeight + , visualScrollColumn = visualScrollColumn } end @@ -88,6 +92,7 @@ struct , windowWidth , windowHeight , startLine + , visualScrollColumn } = app in { mode = newMode @@ -100,6 +105,7 @@ struct , windowWidth = windowWidth , windowHeight = windowHeight , startLine = startLine + , visualScrollColumn = visualScrollColumn } end @@ -116,6 +122,7 @@ struct , windowWidth , windowHeight , startLine + , visualScrollColumn } = app in { mode = newMode @@ -128,6 +135,7 @@ struct , windowWidth = windowWidth , windowHeight = windowHeight , startLine = startLine + , visualScrollColumn = visualScrollColumn } end @@ -151,6 +159,7 @@ struct , windowWidth , windowHeight , startLine + , visualScrollColumn } = app in { searchList = newSearchList @@ -163,6 +172,7 @@ struct , windowWidth = windowWidth , windowHeight = windowHeight , startLine = startLine + , visualScrollColumn = visualScrollColumn } end end diff --git a/fcore/normal-mode/normal-search-mode-with.sml b/fcore/normal-mode/normal-search-mode-with.sml index ef8e1c4..1495b2e 100644 --- a/fcore/normal-mode/normal-search-mode-with.sml +++ b/fcore/normal-mode/normal-search-mode-with.sml @@ -23,6 +23,7 @@ struct , windowWidth , windowHeight , cursorIdx + , visualScrollColumn } = app in { mode = newMode @@ -35,6 +36,7 @@ struct , windowWidth = windowWidth , windowHeight = windowHeight , cursorIdx = cursorIdx + , visualScrollColumn = visualScrollColumn } end @@ -52,6 +54,7 @@ struct , windowWidth , windowHeight , cursorIdx + , visualScrollColumn } = app in { mode = newMode @@ -64,6 +67,7 @@ struct , windowWidth = windowWidth , windowHeight = windowHeight , cursorIdx = cursorIdx + , visualScrollColumn = visualScrollColumn } end @@ -80,6 +84,7 @@ struct , windowWidth , windowHeight , cursorIdx + , visualScrollColumn } = app in { mode = mode @@ -92,6 +97,7 @@ struct , windowWidth = windowWidth , windowHeight = windowHeight , cursorIdx = cursorIdx + , visualScrollColumn = visualScrollColumn } end @@ -109,6 +115,7 @@ struct , startLine , bufferModifyTime , cursorIdx + , visualScrollColumn } = app in { mode = mode @@ -121,6 +128,7 @@ struct , searchString = searchString , bufferModifyTime = bufferModifyTime , cursorIdx = cursorIdx + , visualScrollColumn = visualScrollColumn } end end