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XKJYV42W7AC LLQC2M2IMEJBJQXZTKC3OAKG5WKHSERXKAKCYHQRUZZD6CVRIHAQC H2DPLWMVRFYTO2CQTG54FMT2LF3B6UKLXH32CUA22DNQJVP5XBNQC JYZKEDDGZMLIH3GHTMURYCJ6H7IHZKPG4NT2RUZXLMENPV2UTCVAC KWIVKQQ7AANRG6R4ZRB5TDBZ2TZTXAXIR2P6JNT362KIAJ7JQ4VQC JOPVPUSAMMU6RFVDQR4NJC4GNNUFB7GPKVH7OS5FKCYS5QZ53VLQC PTTZ7YRF3AKTO3LKL2PDC67H34NFKY2FRWL5HK6PZ2YWLPT5IUAAC D4B52CQ2QKG2HQKFUQOO5S2ME325DTW3PH2D7SBXCW4BPQFYG7CAC 3VHUIIATPOF7FXB7NTL5MESCV5BCQACII2D7QZ4UIUCBX3CWXMMAC KB7KTSCPTMQ4MDDP6BJSAZZBHCINAO762XY6GJPFLMIW6BPOEHLAC App.color(Text_color)App.screen.print(screen_line, State.left,y)-- render cursor if necessary
local 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)endelseText.draw_cursor(State, State.left+Text.x(screen_line, State.cursor1.pos-pos+1), y)endendend
local 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 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.-- render fragmentApp.color(Text_color)App.screen.print(screen_line, State.left,y)
local s,e,filename = unpack(link_offsets)local lo, hi = Text.clip_wikiword_with_screen_line(line, line_cache, i, s, e)if lo thenbutton(State, 'link', {x=State.left+lo, y=y, w=hi-lo, h=State.line_height, color={1,1,1},icon = icon.hyperlink_decoration,onpress1 = function()if file_exists(filename) thensource.switch_to_file(filename)endend,})endendif State.selection1.line thenlocal lo, hi = Text.clip_selection(State, line_index, pos, pos+frag_len)
-- 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)end-- render cursor if necessary
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
if 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)endend
-- 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)