diff --git a/0019-B b/0019-B index d4552f4..3071a9e 100644 --- a/0019-B +++ b/0019-B @@ -1,4 +1,4 @@ -B = function(preserve_screen_top_of_cursor_node) +B = function() -- recompute various aspects based on the current viewport settings love.graphics.setFont(love.graphics.newFont(scale(20))) -- editor objects implicitly depend on current font so update it for _,obj in ipairs(Surface) do @@ -17,10 +17,10 @@ B = function(preserve_screen_top_of_cursor_node) obj.zdata = love.math.newBezierCurve(zdata):render() elseif obj.type == 'text' then if obj.w then - update_editor_box(obj, preserve_screen_top_of_cursor_node) + update_editor_box(obj) else obj.text = love.graphics.newText(love.graphics.getFont(), obj.data) end end end -end \ No newline at end of file +end diff --git a/0021-compute_layout b/0021-compute_layout index 6ae7ca8..eb74338 100644 --- a/0021-compute_layout +++ b/0021-compute_layout @@ -1,4 +1,4 @@ -compute_layout = function(node, x,y, nodes_to_render, preserve_screen_top_of_cursor_node) +compute_layout = function(node, x,y, nodes_to_render) -- append to nodes_to_render flattened instructions to render a hierarchy of nodes -- return x,y rendered until (surface coordinates) if node.type == 'text' then @@ -31,7 +31,7 @@ compute_layout = function(node, x,y, nodes_to_render, preserve_screen_top_of_cur if node.editor == nil then initialize_editor(node) else - update_editor_box(node, preserve_screen_top_of_cursor_node) + update_editor_box(node) end node.h = box_height(node) table.insert(nodes_to_render, node) diff --git a/0022-on.text_input b/0022-on.text_input index 69ec2ad..aa9ca81 100644 --- a/0022-on.text_input +++ b/0022-on.text_input @@ -5,6 +5,6 @@ on.text_input = function(t) if not eq(Cursor_node.editor.screen_top1, old_top) then Viewport.y = Cursor_node.y + y_of_schema1(Cursor_node.editor, Cursor_node.editor.screen_top1) end - A(--[[preserve screen_top of cursor node]] true) + A() end -end \ No newline at end of file +end diff --git a/0023-on.keychord_press b/0023-on.keychord_press index 115b09d..6bcdd19 100644 --- a/0023-on.keychord_press +++ b/0023-on.keychord_press @@ -17,7 +17,7 @@ on.keychord_press = function(chord, key) if not eq(Cursor_node.editor.screen_top1, old_top) then Viewport.y = Cursor_node.y + y_of_schema1(Cursor_node.editor, Cursor_node.editor.screen_top1) end - A(--[[preserve screen_top of cursor node]] true) + A() else if chord == 'up' then Viewport.y = Viewport.y - scale(20) @@ -51,4 +51,4 @@ on.keychord_press = function(chord, key) B() end end -end \ No newline at end of file +end diff --git a/0028-A b/0028-A index ef6ad2e..c501e0b 100644 --- a/0028-A +++ b/0028-A @@ -1,4 +1,4 @@ -A = function(preserve_screen_top_of_cursor_node) +A = function() love.graphics.setFont(love.graphics.newFont(scale(20))) -- editor objects implicitly depend on current font -- translate Page to Surface while #Surface > 3 do table.remove(Surface) end -- HACK @@ -9,9 +9,9 @@ A = function(preserve_screen_top_of_cursor_node) red = not red end end - compute_layout(Page, Page.x,Page.y, Surface, preserve_screen_top_of_cursor_node) - compute_layout(Page2, Page2.x,Page2.y, Surface, preserve_screen_top_of_cursor_node) + compute_layout(Page, Page.x,Page.y, Surface) + compute_layout(Page2, Page2.x,Page2.y, Surface) -- continue the pipeline - B(preserve_screen_top_of_cursor_node) + B() -- TODO: ugly that we're manipulating editor objects twice end diff --git a/0030-update_editor_box b/0030-update_editor_box index d259792..e6d779c 100644 --- a/0030-update_editor_box +++ b/0030-update_editor_box @@ -1,8 +1,8 @@ -update_editor_box = function(node, preserve_screen_top_of_cursor_node) +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 not preserve_screen_top_of_cursor_node or node ~= Cursor_node then + if node ~= Cursor_node then node.editor.screen_top1.line = 1 node.editor.screen_top1.pos = 1 end