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P4YW3YPAC JOPVPUSAMMU6RFVDQR4NJC4GNNUFB7GPKVH7OS5FKCYS5QZ53VLQC C7CQOQ6ZDF3O66KAPNWO4QZWXGCYY6VKU3J7RUQKQTF46JTATRGAC -- render search highlight or cursorif State.search_term thenlocal data = State.lines[State.cursor1.line].datalocal cursor_offset = Text.offset(data, State.cursor1.pos)if data:sub(cursor_offset, cursor_offset+#State.search_term-1) == State.search_term thenlocal save_selection = State.selection1State.selection1 = {line=line_index, pos=State.cursor1.pos+utf8.len(State.search_term)}local lo, hi = Text.clip_selection(State, line_index, pos, pos+frag_len)Text.draw_highlight(State, line, State.left,y, pos, lo,hi)State.selection1 = save_selectionendelseif Focus == 'edit' thenend-- render colorized textlocal x = State.leftfor frag in screen_line:gmatch('%S*%s*') doselect_color(frag)App.screen.print(frag, x,y)x = x+App.width(frag)endif pos <= State.cursor1.pos and pos + frag_len > State.cursor1.pos thenText.draw_cursor(State, State.left+Text.x(screen_line, State.cursor1.pos-pos+1), y)elseif pos + frag_len == State.cursor1.pos then-- Show cursor at end of line.-- This place also catches end of wrapping screen lines. That doesn't seem worth distinguishing.-- It seems useful to see a cursor whether your eye is on the left or right margin.Text.draw_cursor(State, State.left+Text.x(screen_line, State.cursor1.pos-pos+1), y)
if not hide_cursor and line_index == State.cursor1.line then-- render search highlight or cursorif State.search_term thenlocal data = State.lines[State.cursor1.line].datalocal cursor_offset = Text.offset(data, State.cursor1.pos)if data:sub(cursor_offset, cursor_offset+#State.search_term-1) == State.search_term thenlocal save_selection = State.selection1State.selection1 = {line=line_index, pos=State.cursor1.pos+utf8.len(State.search_term)}local lo, hi = Text.clip_selection(State, line_index, pos, pos+frag_len)Text.draw_highlight(State, line, State.left,y, pos, lo,hi)State.selection1 = save_selectionendelseif Focus == 'edit' thenif pos <= State.cursor1.pos and pos + frag_len > State.cursor1.pos thenText.draw_cursor(State, State.left+Text.x(screen_line, State.cursor1.pos-pos+1), y)elseif pos + frag_len == State.cursor1.pos then-- Show cursor at end of line.-- This place also catches end of wrapping screen lines. That doesn't seem worth distinguishing.-- It seems useful to see a cursor whether your eye is on the left or right margin.Text.draw_cursor(State, State.left+Text.x(screen_line, State.cursor1.pos-pos+1), y)endendend
-- render cursor if necessaryif not hide_cursor and line_index == State.cursor1.line thenif pos <= State.cursor1.pos and pos + frag_len >= State.cursor1.pos thenif State.search_term thenlocal data = State.lines[State.cursor1.line].datalocal cursor_offset = Text.offset(data, State.cursor1.pos)if data:sub(cursor_offset, cursor_offset+#State.search_term-1) == State.search_term thenlocal lo_px = Text.draw_highlight(State, line, State.left,y, pos, State.cursor1.pos, State.cursor1.pos+utf8.len(State.search_term))App.color(Text_color)love.graphics.print(State.search_term, State.left+lo_px,y)endelseif Focus == 'edit' thenText.draw_cursor(State, State.left+Text.x(screen_line, State.cursor1.pos-pos+1), y)endendend