about summary refs log tree commit diff stats
path: root/source.lua
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2022-09-19 00:17:36 -0700
committerKartik K. Agaram <vc@akkartik.com>2022-09-19 00:17:36 -0700
commit12b1d19761a1c45ff354cdeb7c0b3a176a4ca11a (patch)
tree31adee3229f74f41e8d801c0004c46576759b641 /source.lua
parent34dc49849b9d64707cfd0301b07dafd74e971c14 (diff)
downloadtext.love-12b1d19761a1c45ff354cdeb7c0b3a176a4ca11a.tar.gz
source: load cursor position from settings
Diffstat (limited to 'source.lua')
-rw-r--r--source.lua7
1 files changed, 5 insertions, 2 deletions
diff --git a/source.lua b/source.lua
index 9ccb108..605f999 100644
--- a/source.lua
+++ b/source.lua
@@ -86,6 +86,8 @@ end
 function source.initialize_edit_side()
   load_from_disk(Editor_state)
   Text.redraw_all(Editor_state)
+  Editor_state.screen_top1 = File_navigation.cursors[Editor_state.filename].screen_top1
+  Editor_state.cursor1 = File_navigation.cursors[Editor_state.filename].cursor1
 
   -- We currently start out with side B collapsed.
   -- Other options:
@@ -127,8 +129,9 @@ function source.load_settings()
   end
   Editor_state = edit.initialize_state(Margin_top, Margin_left, right, settings.font_height, math.floor(settings.font_height*1.3))
   Editor_state.filename = settings.filename
-  Editor_state.screen_top1 = settings.screen_top
-  Editor_state.cursor1 = settings.cursor
+  File_navigation.cursors = settings.cursors
+  Editor_state.screen_top1 = File_navigation.cursors[Editor_state.filename].screen_top1
+  Editor_state.cursor1 = File_navigation.cursors[Editor_state.filename].cursor1
 end
 
 function source.set_window_position_from_settings(settings)