if pos then
Cursor1.line = i
Cursor1.pos = pos
break
end
end
end
if pos == nil then
Cursor1.line = Search_backup_cursor1.line
Cursor1.pos = Search_backup_cursor1.pos
end
if Text.lt1(Cursor1, Screen_top1) or Text.lt1(Screen_bottom1, Cursor1) then
Screen_top1.line = Cursor1.line
local _, pos = Text.pos_at_start_of_cursor_screen_line()
Screen_top1.pos = pos
end
end
function Text.search_previous()
-- search current line
local pos = rfind(Lines[Cursor1.line].data, Search_term, Cursor1.pos)
if pos then
Cursor1.pos = pos
end
if pos == nil then
for i=Cursor1.line-1,1,-1 do
pos = rfind(Lines[i].data, Search_term)