broadsheet.love/0016-resync_editors

20 lines
913 B
Plaintext

resync_editors = function()
edit.draw(Editors[1], Text_color) -- initialize screen_bottom1
for e=2,#Editors do
local editor = Editors[e]
if Editors[e-1].screen_bottom1.line then
-- there's something left to draw on this column
editor.screen_top1 = {line=Editors[e-1].screen_bottom1.line, pos=Editors[e-1].screen_bottom1.pos}
-- scroll down one line
Text.populate_screen_line_starting_pos(editor, editor.screen_top1.line)
local _, screen_line_index = Text.pos_at_start_of_screen_line(editor, editor.screen_top1)
if screen_line_index < #editor.line_cache[editor.screen_top1.line].screen_line_starting_pos then
editor.screen_top1.pos = editor.line_cache[editor.screen_top1.line].screen_line_starting_pos[screen_line_index+1]
else
editor.screen_top1 = {line=editor.screen_top1.line+1, pos=1}
end
edit.draw(Editors[e], Text_color) -- initialize screen_bottom1
end
end
end