Merge upstream

This commit is contained in:
Kartik K. Agaram 2022-08-15 15:57:10 -07:00
commit 5ac18cef45

View File

@ -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