start thinking of compute_fragments as a detail

I think all we need to maintain is the populate_screen_line_starting_pos
array. It's easy to render screen lines one by one from it, and we'll
only ever construct one additional screen line at a time.

I'd hoped to delete other calls to Text.populate_screen_line_starting_pos,
but it turns out we need to update it when editing sometimes. Give up on
that for now; it's a no-op if not needed.
This commit is contained in:
Kartik K. Agaram 2023-04-01 17:05:57 -07:00
parent 24a732ebff
commit c87e4a3bab
2 changed files with 2 additions and 2 deletions

View File

@ -12,7 +12,7 @@ function Text.draw(State, line_index, y, startpos, hide_cursor)
local x = State.left
local pos = 1
local screen_line_starting_pos = startpos
Text.compute_fragments(State, line_index)
Text.populate_screen_line_starting_pos(State, line_index)
local pos = 1
initialize_color()
for _, f in ipairs(line_cache.fragments) do

View File

@ -12,7 +12,7 @@ function Text.draw(State, line_index, y, startpos)
local x = State.left
local pos = 1
local screen_line_starting_pos = startpos
Text.compute_fragments(State, line_index)
Text.populate_screen_line_starting_pos(State, line_index)
for _, f in ipairs(line_cache.fragments) do
App.color(Text_color)
local frag_len = utf8.len(f)