diff options
-rw-r--r-- | text.lua | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/text.lua b/text.lua index d46b6d4..bbe610a 100644 --- a/text.lua +++ b/text.lua @@ -17,16 +17,13 @@ function Text.draw(State, line_index, y, startpos) -- wrap long lines local x = State.left local pos = 1 - local screen_line_starting_pos = State.screen_top1.pos - if line_cache.fragments == nil then - Text.compute_fragments(State, line_index) - end + local screen_line_starting_pos = startpos Text.populate_screen_line_starting_pos(State, line_index) for _, f in ipairs(line_cache.fragments) do local frag, frag_text = f.data, f.text local frag_len = utf8.len(frag) --? print('text.draw:', frag, 'at', line_index,pos, 'after', x,y) - if Text.lt1({line=line_index, pos=pos}, State.screen_top1) then + if pos < startpos then -- render nothing --? print('skipping', frag) else @@ -638,9 +635,6 @@ end function Text.to_pos_on_line(State, line_index, mx, my) local line = State.lines[line_index] local line_cache = State.line_cache[line_index] - if line_cache.fragments == nil then - Text.compute_fragments(State, line_index) - end assert(my >= line_cache.starty) -- duplicate some logic from Text.draw local y = line_cache.starty |