diff options
-rw-r--r-- | source_text.lua | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/source_text.lua b/source_text.lua index d0b4fcc..cf3d00f 100644 --- a/source_text.lua +++ b/source_text.lua @@ -44,8 +44,13 @@ function Text.draw(State, line_index, y, startpos, hide_cursor) 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 - select_color(f) - App.screen.print(f, State.left,y) + -- render colorized text + local x = State.left + for frag in f:gmatch('%S*%s*') do + select_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 if pos <= State.cursor1.pos and pos + frag_len >= State.cursor1.pos then |