2023-01-03 11:15:03 +00:00
|
|
|
update_editor_box = function(node, preserve_screen_top_of_cursor_node)
|
|
|
|
if node.editor == nil then return end
|
|
|
|
-- Compute screen_top1 in viewport coordinates because the editor's font takes scaling into account.
|
|
|
|
if vy(node.y) > 0 then
|
|
|
|
if not preserve_screen_top_of_cursor_node or node ~= Cursor_node then
|
|
|
|
node.editor.screen_top1.line = 1
|
|
|
|
node.editor.screen_top1.pos = 1
|
|
|
|
end
|
|
|
|
node.editor.top = vy(node.y)
|
|
|
|
else
|
|
|
|
node.editor.screen_top1, node.editor.top = schema1_of_y(node.editor, -vy(node.y))
|
|
|
|
end
|
2023-04-03 01:10:21 +01:00
|
|
|
node.editor.left = math.floor(vx(node.x)) + Line_number_width*App.width('m')
|
2023-01-03 11:15:03 +00:00
|
|
|
node.editor.right = math.ceil(vx(node.x+node.w))
|
2023-04-23 06:21:42 +01:00
|
|
|
node.editor.width = node.editor.right - node.editor.left
|
2023-04-03 01:10:21 +01:00
|
|
|
end
|