diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2024-06-23 10:36:53 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2024-06-23 10:36:53 -0700 |
commit | a2f526ad1951679529fc75775fcb9847455c0714 (patch) | |
tree | 2ae67bac301fd42c51ed4b74157dfc4d113d54ce | |
parent | a7d42f115b77f93b30fe325a8c4825265f1517dd (diff) | |
download | view.love-a2f526ad1951679529fc75775fcb9847455c0714.tar.gz |
bugfix: restart search on backspace
This feels better when I press a few keys, then backspace and press new keys. It might be confusing if I hit 'down' a few times then backspace, but I seldom do that.
-rw-r--r-- | edit.lua | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/edit.lua b/edit.lua index 1fbe682..afff2ca 100644 --- a/edit.lua +++ b/edit.lua @@ -403,6 +403,9 @@ function edit.keychord_press(State, chord, key) local len = utf8.len(State.search_term) local byte_offset = Text.offset(State.search_term, len) State.search_term = string.sub(State.search_term, 1, byte_offset-1) + State.cursor = deepcopy(State.search_backup.cursor) + State.screen_top = deepcopy(State.search_backup.screen_top) + Text.search_next(State) elseif chord == 'down' then State.cursor1.pos = State.cursor1.pos+1 Text.search_next(State) |