let's see if this is easier to understand in 6 mos

I spent 4 days agonizing over a bug in driver.love, working up the
courage to think about it, and then a whole day trying to make sense of
scrolling and deeply questioning my right to tell anyone anything about
programming.
This commit is contained in:
Kartik K. Agaram 2023-10-22 19:50:08 -07:00
parent 09b8f985db
commit e93b2796d2
1 changed files with 2 additions and 3 deletions

View File

@ -1,14 +1,13 @@
update_editor_box = function(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 node.y > Viewport.y then
if 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))
node.editor.screen_top1, node.editor.top = schema1_of_y(node.editor, scale(Viewport.y-node.y)) -- scale y because editor's font is scaled
end
node.editor.left = math.floor(vx(node.x))
node.editor.right = math.ceil(vx(node.x+node.w))