about summary refs log tree commit diff stats
path: root/search.lua
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2024-10-29 16:04:14 -0700
committerKartik K. Agaram <vc@akkartik.com>2024-10-29 16:04:14 -0700
commit1693f1f160e0567cf0bf1f26d3d61f577082cdfb (patch)
tree5fadc16bed61ceccbbda889840f1b43cefb20f07 /search.lua
parentc1a3616964bfdeb11144c0e7289fc16ba563e84a (diff)
downloadlines.love-1693f1f160e0567cf0bf1f26d3d61f577082cdfb.tar.gz
bugfix #2 in search UI
Diffstat (limited to 'search.lua')
-rw-r--r--search.lua2
1 files changed, 2 insertions, 0 deletions
diff --git a/search.lua b/search.lua
index d3a5fea..2b4ea99 100644
--- a/search.lua
+++ b/search.lua
@@ -17,6 +17,7 @@ function Text.draw_search_bar(State)
 end
 
 function Text.search_next(State)
+  assert(#State.search_term > 0)
   -- search current line from cursor
   local curr_pos = State.cursor1.pos
   local curr_line = State.lines[State.cursor1.line].data
@@ -71,6 +72,7 @@ function Text.search_next(State)
 end
 
 function Text.search_previous(State)
+  assert(#State.search_term > 0)
   -- search current line before cursor
   local curr_pos = State.cursor1.pos
   local curr_line = State.lines[State.cursor1.line].data