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MEY6K3EBRIHZHS4QBK27VONJC5537COQC
ESETRNLB3MIJ2SID6HJMMP52FEVUBLGK2HLWD75KDQZAKQMKSF2QC
YTSPVDZHEN5LLNMGIBUBLPWFWSFM3SOHBRGWYSDEVFKRTH24ARRQC
6LJZN727CRPYR34LV75CQF55YZI3E7MGESYZSFSYAE73SNEZE3FAC
Text.draw_cursor(x+Text.x(frag, Cursor1.pos-pos+1), y)
if Search_term then
if Lines[Cursor1.line].data:sub(Cursor1.pos, Cursor1.pos+utf8.len(Search_term)-1) == Search_term then
if Search_text == nil then
Search_text = App.newText(love.graphics.getFont(), Search_term)
end
love.graphics.setColor(0.7,1,1)
love.graphics.rectangle('fill', x,y, math.floor(App.width(Search_text)*Zoom),math.floor(15*Zoom))
love.graphics.setColor(0,0,0)
love.graphics.print(Search_term, x,y, 0, Zoom)
end
else
Text.draw_cursor(x+Text.x(frag, Cursor1.pos-pos+1), y)
end
if line_index == Cursor1.line and Cursor1.pos == pos then
Text.draw_cursor(x, y)
if Search_term == nil then
if line_index == Cursor1.line and Cursor1.pos == pos then
Text.draw_cursor(x, y)
end
function Text.draw_search_bar()
local h = math.floor(15*Zoom)+2
local y = App.screen.height-h
love.graphics.setColor(0.9,0.9,0.9)
love.graphics.rectangle('fill', 0, y-10, App.screen.width-1, h+8)
love.graphics.setColor(0.6,0.6,0.6)
love.graphics.line(0, y-10, App.screen.width-1, y-10)
love.graphics.setColor(1,1,1)
love.graphics.rectangle('fill', 20, y-6, App.screen.width-40, h+2, 2,2)
love.graphics.setColor(0.6,0.6,0.6)
love.graphics.rectangle('line', 20, y-6, App.screen.width-40, h+2, 2,2)
love.graphics.setColor(0,0,0)
App.screen.print(Search_term, 25,y-5, 0, Zoom)
love.graphics.setColor(1,0,0)
if Search_text == nil then
Search_text = App.newText(love.graphics.getFont(), Search_term)
end
love.graphics.circle('fill', 25+math.floor(App.width(Search_text)*Zoom),y-5+h, 2)
love.graphics.setColor(0,0,0)
end
function Text.search_next()
-- search current line
local pos = Lines[Cursor1.line].data:find(Search_term, Cursor1.pos)
if pos then
Cursor1.pos = pos
end
if pos == nil then
for i=Cursor1.line+1,#Lines do
pos = Lines[i].data:find(Search_term)
if pos then
Cursor1.line = i
Cursor1.pos = pos
break
end
end
end
if pos == nil then
-- wrap around
for i=1,Cursor1.line-1 do
pos = Lines[i].data:find(Search_term)
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
if love.mouse.isDown('1') or chord:sub(1,2) == 'C-' then
if Search_term then
if chord == 'escape' then
Search_term = nil
Search_text = nil
Cursor1 = Search_backup_cursor1
Search_backup_cursor1 = nil
elseif chord == 'return' then
Search_term = nil
Search_text = nil
elseif chord == 'backspace' then
local len = utf8.len(Search_term)
local byte_offset = utf8.offset(Search_term, len)
Search_term = string.sub(Search_term, 1, byte_offset-1)
Search_text = nil
elseif chord == 'down' then
Cursor1.pos = Cursor1.pos+1
Text.search_next()
end
return
elseif chord == 'C-f' then
Search_term = ''
Search_backup_cursor1 = {line=Cursor1.line, pos=Cursor1.pos}
assert(Search_text == nil)
elseif love.mouse.isDown('1') or chord:sub(1,2) == 'C-' then