diff options
Diffstat (limited to 'search.lua')
-rw-r--r-- | search.lua | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/search.lua b/search.lua index ce089d3..1872b9e 100644 --- a/search.lua +++ b/search.lua @@ -21,14 +21,14 @@ end function Text.search_next(State) -- search current line from cursor - local pos = find(State.lines[State.cursor1.line], State.search_term, State.cursor1.pos) + local pos = find(State.lines[State.cursor1.line].data, State.search_term, State.cursor1.pos) if pos then State.cursor1.pos = pos end if pos == nil then -- search lines below cursor for i=State.cursor1.line+1,#State.lines do - pos = find(State.lines[i], State.search_term) + pos = find(State.lines[i].data, State.search_term) if pos then State.cursor1.line = i State.cursor1.pos = pos @@ -39,7 +39,7 @@ function Text.search_next(State) if pos == nil then -- wrap around for i=1,State.cursor1.line-1 do - pos = find(State.lines[i], State.search_term) + pos = find(State.lines[i].data, State.search_term) if pos then State.cursor1.line = i State.cursor1.pos = pos @@ -49,7 +49,7 @@ function Text.search_next(State) end if pos == nil then -- search current line until cursor - pos = find(State.lines[State.cursor1.line], State.search_term) + pos = find(State.lines[State.cursor1.line].data, State.search_term) if pos and pos < State.cursor1.pos then State.cursor1.pos = pos end @@ -69,14 +69,14 @@ end function Text.search_previous(State) -- search current line before cursor - local pos = rfind(State.lines[State.cursor1.line], State.search_term, State.cursor1.pos-1) + local pos = rfind(State.lines[State.cursor1.line].data, State.search_term, State.cursor1.pos-1) if pos then State.cursor1.pos = pos end if pos == nil then -- search lines above cursor for i=State.cursor1.line-1,1,-1 do - pos = rfind(State.lines[i], State.search_term) + pos = rfind(State.lines[i].data, State.search_term) if pos then State.cursor1.line = i State.cursor1.pos = pos @@ -87,7 +87,7 @@ function Text.search_previous(State) if pos == nil then -- wrap around for i=#State.lines,State.cursor1.line+1,-1 do - pos = rfind(State.lines[i], State.search_term) + pos = rfind(State.lines[i].data, State.search_term) if pos then State.cursor1.line = i State.cursor1.pos = pos @@ -97,7 +97,7 @@ function Text.search_previous(State) end if pos == nil then -- search current line after cursor - pos = rfind(State.lines[State.cursor1.line], State.search_term) + pos = rfind(State.lines[State.cursor1.line].data, State.search_term) if pos and pos > State.cursor1.pos then State.cursor1.pos = pos end |