From 6975b8b7210296da1280a56c29f279eac39cdbda Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Tue, 29 Oct 2024 17:47:38 -0700 Subject: [PATCH] bugfix #3, attempt #2 in search UI Avoid accidental side-effects. --- edit.lua | 6 ++++-- source_edit.lua | 4 +--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/edit.lua b/edit.lua index 9e80cc3..44e58ab 100644 --- a/edit.lua +++ b/edit.lua @@ -426,8 +426,10 @@ function edit.keychord_press(State, chord, key) State.screen_top = deepcopy(State.search_backup.screen_top) Text.search_next(State) elseif chord == 'down' then - edit.put_cursor_on_next_text_loc_wrapping_around_if_necessary(State) - Text.search_next(State) + if #State.search_term > 0 then + edit.put_cursor_on_next_text_loc_wrapping_around_if_necessary(State) + Text.search_next(State) + end elseif chord == 'up' then Text.search_previous(State) end diff --git a/source_edit.lua b/source_edit.lua index 733ca61..7599a4a 100644 --- a/source_edit.lua +++ b/source_edit.lua @@ -437,9 +437,7 @@ function edit.keychord_press(State, chord, key) Text.search_next(State) end elseif chord == 'up' then - if #State.search_term > 0 then - Text.search_previous(State) - end + Text.search_previous(State) end return elseif chord == 'C-f' then -- 2.11.4.GIT