diff options
Diffstat (limited to 'text.lua')
-rw-r--r-- | text.lua | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/text.lua b/text.lua index a477c4f..da97a55 100644 --- a/text.lua +++ b/text.lua @@ -22,13 +22,11 @@ function Text.draw(State, line_index, y, startpos) local screen_line = Text.screen_line(line, line_cache, i) --? print('text.draw:', screen_line, 'at', line_index,pos, 'after', x,y) local frag_len = utf8.len(screen_line) - -- render fragment + -- render any highlights if State.selection1.line then local lo, hi = Text.clip_selection(State, line_index, pos, pos+frag_len) Text.draw_highlight(State, line, State.left,y, pos, lo,hi) end - App.color(Text_color) - App.screen.print(screen_line, State.left,y) if line_index == State.cursor1.line then -- render search highlight or cursor if State.search_term then @@ -37,9 +35,7 @@ function Text.draw(State, line_index, y, startpos) local cursor_offset = Text.offset(data, State.cursor1.pos) if data:sub(cursor_offset, cursor_offset+#State.search_term-1) == State.search_term then local hi = State.cursor1.pos+utf8.len(State.search_term) - local lo_px = Text.draw_highlight(State, line, State.left,y, pos, State.cursor1.pos, hi) - App.color(Text_color) - love.graphics.print(State.search_term, State.left+lo_px,y) + Text.draw_highlight(State, line, State.left,y, pos, State.cursor1.pos, hi) end end else @@ -53,6 +49,9 @@ function Text.draw(State, line_index, y, startpos) end end end + -- render fragment + App.color(Text_color) + App.screen.print(screen_line, State.left,y) y = y + State.line_height if y >= App.screen.height then break |