diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2022-09-19 00:41:37 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2022-09-19 00:41:37 -0700 |
commit | 2f7b08fb8b63ce704b99f49fcaaab9a59fb591d8 (patch) | |
tree | cc64aca3dd97fe6d41ad9ebbe7cb3f877d0736d2 | |
parent | 690a1c334c68a4423fdd9752e9918aec06e135df (diff) | |
download | view.love-2f7b08fb8b63ce704b99f49fcaaab9a59fb591d8.tar.gz |
handle missing cursors in settings
-rw-r--r-- | source.lua | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/source.lua b/source.lua index 605f999..14730df 100644 --- a/source.lua +++ b/source.lua @@ -129,9 +129,15 @@ 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 - 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 + if settings.cursors then + 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 + else + -- migrate old settings + Editor_state.screen_top1 = {line=1, pos=1} + Editor_state.cursor1 = {line=1, pos=1} + end end function source.set_window_position_from_settings(settings) |