about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2024-10-28 21:49:24 -0700
committerKartik K. Agaram <vc@akkartik.com>2024-10-28 21:49:24 -0700
commit1609d79516b2e8f790648fd67614d9edb9c2e24c (patch)
treefc5559baa2d9587a334689cc0397c49541ef0d03
parente0ccf1de675d8b84553a8692d4616020f420e93e (diff)
downloadtext.love-1609d79516b2e8f790648fd67614d9edb9c2e24c.tar.gz
bugfix: restart search on backspace
Ported from bugfix of 2024-06-23.
-rw-r--r--source_edit.lua3
1 files changed, 3 insertions, 0 deletions
diff --git a/source_edit.lua b/source_edit.lua
index 53bd16a..3c0f794 100644
--- a/source_edit.lua
+++ b/source_edit.lua
@@ -407,6 +407,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)