about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--edit.lua10
-rw-r--r--search.lua4
2 files changed, 5 insertions, 9 deletions
diff --git a/edit.lua b/edit.lua
index 91ea8e0..9e80cc3 100644
--- a/edit.lua
+++ b/edit.lua
@@ -426,14 +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
-      if #State.search_term > 0 then
-        edit.put_cursor_on_next_text_loc_wrapping_around_if_necessary(State)
-        Text.search_next(State)
-      end
+      edit.put_cursor_on_next_text_loc_wrapping_around_if_necessary(State)
+      Text.search_next(State)
     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
diff --git a/search.lua b/search.lua
index 2b4ea99..4aa1f02 100644
--- a/search.lua
+++ b/search.lua
@@ -17,7 +17,7 @@ function Text.draw_search_bar(State)
 end
 
 function Text.search_next(State)
-  assert(#State.search_term > 0)
+  if #State.search_term == 0 then return end
   -- search current line from cursor
   local curr_pos = State.cursor1.pos
   local curr_line = State.lines[State.cursor1.line].data
@@ -72,7 +72,7 @@ function Text.search_next(State)
 end
 
 function Text.search_previous(State)
-  assert(#State.search_term > 0)
+  if #State.search_term == 0 then return end
   -- search current line before cursor
   local curr_pos = State.cursor1.pos
   local curr_line = State.lines[State.cursor1.line].data