diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2022-06-03 13:59:40 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2022-06-03 13:59:40 -0700 |
commit | 06e6ecdf8f8f8f8489b2e0d1145698a52a7c3ae5 (patch) | |
tree | a30efc9ec74af4323530b57ed37ec3dc97979854 /main.lua | |
parent | ac83252684762b7d7267dda5c7fb6147976570c0 (diff) | |
download | text.love-06e6ecdf8f8f8f8489b2e0d1145698a52a7c3ae5.tar.gz |
bugfix: restore state after C-f (find)
Diffstat (limited to 'main.lua')
-rw-r--r-- | main.lua | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/main.lua b/main.lua index 25afc7e..3e60d19 100644 --- a/main.lua +++ b/main.lua @@ -77,7 +77,7 @@ Next_history = 1 -- search Search_term = nil Search_text = nil -Search_backup_cursor1 = nil -- where to position the cursor if search term was not found +Search_backup = nil -- stuff to restore when cancelling search end -- App.initialize_globals @@ -249,11 +249,13 @@ function App.keychord_pressed(chord) if chord == 'escape' then Search_term = nil Search_text = nil - Cursor1 = Search_backup_cursor1 - Search_backup_cursor1 = nil + Cursor1 = Search_backup.cursor + Screen_top1 = Search_backup.screen_top + Search_backup = nil elseif chord == 'return' then Search_term = nil Search_text = nil + Search_backup = nil elseif chord == 'backspace' then local len = utf8.len(Search_term) local byte_offset = utf8.offset(Search_term, len) @@ -268,7 +270,7 @@ function App.keychord_pressed(chord) return elseif chord == 'C-f' then Search_term = '' - Search_backup_cursor1 = {line=Cursor1.line, pos=Cursor1.pos} + Search_backup = {cursor={line=Cursor1.line, pos=Cursor1.pos}, screen_top={line=Screen_top1.line, pos=Screen_top1.pos}} assert(Search_text == nil) elseif chord == 'C-=' then Font_height = Font_height+2 |