diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2022-07-25 09:49:26 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2022-07-25 09:49:26 -0700 |
commit | 3265abacb42056742803d7e2a42a2757ce7984c0 (patch) | |
tree | b7ce7eb2c568af5a53fdf7357ddbdc09195e30f1 /search.lua | |
parent | 6f74f95a46b173f7b4f8c04e5821dc348191192e (diff) | |
download | lines.love-3265abacb42056742803d7e2a42a2757ce7984c0.tar.gz |
bugfix: skip over drawings when searching
Diffstat (limited to 'search.lua')
-rw-r--r-- | search.lua | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/search.lua b/search.lua index 2e86688..41d2b8f 100644 --- a/search.lua +++ b/search.lua @@ -22,18 +22,25 @@ function Text.draw_search_bar(State) end function Text.search_next(State) + local pos -- search current line - local pos = State.lines[State.cursor1.line].data:find(State.search_term, State.cursor1.pos) - if pos then - State.cursor1.pos = pos + local line = State.lines[State.cursor1.line] + if line.mode == 'text' then + pos = line.data:find(State.search_term, State.cursor1.pos) + if pos then + State.cursor1.pos = pos + end end if pos == nil then for i=State.cursor1.line+1,#State.lines do - pos = State.lines[i].data:find(State.search_term) - if pos then - State.cursor1.line = i - State.cursor1.pos = pos - break + local line = State.lines[i] + if line.mode == 'text' then + pos = State.lines[i].data:find(State.search_term) + if pos then + State.cursor1.line = i + State.cursor1.pos = pos + break + end end end end |