pothi.love/0370-update_editor_box

17 lines
652 B
Plaintext

update_editor_box = function(obj, skip_cursor_node)
if obj.editor == nil then return end
if skip_cursor_node and obj == Cursor_node then return end
if obj.y > Viewport.y then
obj.editor.screen_top1.line = 1
obj.editor.screen_top1.pos = 1
obj.editor.top = vy(obj.y)
else
obj.editor.screen_top1, obj.editor.top = schema1_of_y(obj.editor, Viewport.y - obj.y)
end
print('top', obj.editor.top)
print('screen_top1', obj.editor.screen_top1.line, obj.editor.screen_top1.pos)
obj.editor.left = math.floor(vx(obj.x))
obj.editor.right = math.ceil(vx(obj.x+obj.w))
edit.update_font_settings(obj.editor, scale(20))
Text.redraw_all(obj.editor)
end