remove some unnecessary work

Let's see if this makes things less sluggish. Before this a surface with
just 4 definitions (few 10s of LoC in 3 of them) was sluggish.
This commit is contained in:
Kartik K. Agaram 2023-01-03 03:15:03 -08:00
parent 5339a95a77
commit d830eff1a8
13 changed files with 100 additions and 1 deletions

1
0707-manifest Normal file
View File

@ -0,0 +1 @@
{"Mouse_cursor":559,"text_input_on_manifest_navigator":634,"manifest_coord":636,"manifest_index":637,"manifest_navigator_candidates":638,"Cursor_node":172,"add_def_to_menu":640,"order_of_magnitude":573,"approximate":579,"box_height":680,"on.draw":565,"font":353,"on.code_change":306,"Viewport":604,"on.initialize":695,"A":507,"Manifest_navigator":495,"B":379,"on.update":561,"on.keychord_press":666,"load_definition":682,"on":1,"initialize_editor":678,"get_manifest":706,"on.save_settings":702,"on.load_settings":700,"approximate_up":658,"Definitions":503,"new_definition":681,"table_and_array_both_empty":689,"maybe_update_key_in_definitions":529,"update_editor_box":707,"Surface":422,"scale":7,"on.mouse_release":554,"vx":545,"draw_cursor":639,"set_mouse_cursor":562,"schema1_of_y":667,"Menu_background_color":611,"draw_ticks":663,"Menu_border_color":612,"manifest_navigator_down":635,"Menu_command_color":613,"load_manifest":694,"y_of_schema1":364,"on_handle":547,"draw_menu_bar":641,"manifest_navigator_up":628,"add_hotkey_to_menu":616,"Manifest":494,"on_text":539,"draw_manifest_navigator":677,"on.mouse_press":617,"num_lines_for_manifest_navigator":676,"sy":469,"Ticks_font":669,"reset_manifest_navigator":621,"sx":544,"line_height":365,"load_from_iterator":670,"add_thick_line":400,"get_definition_from_app":624,"copy_shape":396,"tick_spec":660,"on.text_input":521,"on.key_release":552,"fw_parent":706,"Page":475,"fw_app":"driver","Menu_highlight_color":614,"vy":546,"delete_definition":673,"compute_layout":385,"move_candidate_to_front_of_manifest":632,"mouse_cursor":558,"keychord_press_on_manifest_navigator":675}

18
0707-update_editor_box Normal file
View File

@ -0,0 +1,18 @@
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
if nonde.editor.font_height ~= scale(20) then
edit.update_font_settings(node.editor, scale(20))
end
node.editor.left = math.floor(vx(node.x)) + Line_number_width*App.width(node.editor.em)
node.editor.right = math.ceil(vx(node.x+node.w))
end

1
0708-manifest Normal file
View File

@ -0,0 +1 @@
{"Mouse_cursor":559,"text_input_on_manifest_navigator":634,"manifest_coord":636,"manifest_index":637,"manifest_navigator_candidates":638,"Cursor_node":172,"add_def_to_menu":640,"order_of_magnitude":573,"approximate":579,"box_height":680,"on.draw":565,"font":353,"on.code_change":306,"Viewport":604,"on.initialize":695,"A":507,"Manifest_navigator":495,"B":379,"on.update":561,"on.keychord_press":666,"load_definition":682,"on":1,"initialize_editor":678,"get_manifest":706,"on.save_settings":702,"on.load_settings":700,"approximate_up":658,"Definitions":503,"new_definition":681,"table_and_array_both_empty":689,"maybe_update_key_in_definitions":529,"update_editor_box":708,"Surface":422,"scale":7,"on.mouse_release":554,"vx":545,"draw_cursor":639,"set_mouse_cursor":562,"schema1_of_y":667,"Menu_background_color":611,"draw_ticks":663,"Menu_border_color":612,"manifest_navigator_down":635,"Menu_command_color":613,"load_manifest":694,"y_of_schema1":364,"on_handle":547,"draw_menu_bar":641,"manifest_navigator_up":628,"add_hotkey_to_menu":616,"Manifest":494,"on_text":539,"draw_manifest_navigator":677,"on.mouse_press":617,"num_lines_for_manifest_navigator":676,"sy":469,"Ticks_font":669,"reset_manifest_navigator":621,"sx":544,"line_height":365,"load_from_iterator":670,"add_thick_line":400,"get_definition_from_app":624,"copy_shape":396,"tick_spec":660,"on.text_input":521,"on.key_release":552,"fw_parent":707,"Page":475,"fw_app":"driver","Menu_highlight_color":614,"vy":546,"delete_definition":673,"compute_layout":385,"move_candidate_to_front_of_manifest":632,"mouse_cursor":558,"keychord_press_on_manifest_navigator":675}

18
0708-update_editor_box Normal file
View File

@ -0,0 +1,18 @@
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
if node.editor.font_height ~= scale(20) then
edit.update_font_settings(node.editor, scale(20))
end
node.editor.left = math.floor(vx(node.x)) + Line_number_width*App.width(node.editor.em)
node.editor.right = math.ceil(vx(node.x+node.w))
end

1
0709-manifest Normal file
View File

@ -0,0 +1 @@
{"Mouse_cursor":559,"text_input_on_manifest_navigator":634,"manifest_coord":636,"manifest_index":637,"manifest_navigator_candidates":638,"Cursor_node":172,"add_def_to_menu":640,"order_of_magnitude":573,"approximate":579,"box_height":680,"on.draw":565,"font":353,"on.code_change":306,"Viewport":604,"on.initialize":695,"A":507,"Manifest_navigator":495,"B":379,"on.update":561,"on.keychord_press":666,"load_definition":682,"on":1,"initialize_editor":678,"get_manifest":706,"on.save_settings":702,"on.load_settings":700,"approximate_up":658,"Definitions":503,"new_definition":681,"table_and_array_both_empty":689,"maybe_update_key_in_definitions":529,"update_editor_box":709,"Surface":422,"scale":7,"on.mouse_release":554,"vx":545,"draw_cursor":639,"set_mouse_cursor":562,"schema1_of_y":667,"Menu_background_color":611,"draw_ticks":663,"Menu_border_color":612,"manifest_navigator_down":635,"Menu_command_color":613,"load_manifest":694,"y_of_schema1":364,"on_handle":547,"draw_menu_bar":641,"manifest_navigator_up":628,"add_hotkey_to_menu":616,"Manifest":494,"on_text":539,"draw_manifest_navigator":677,"on.mouse_press":617,"num_lines_for_manifest_navigator":676,"sy":469,"Ticks_font":669,"reset_manifest_navigator":621,"sx":544,"line_height":365,"load_from_iterator":670,"add_thick_line":400,"get_definition_from_app":624,"copy_shape":396,"tick_spec":660,"on.text_input":521,"on.key_release":552,"fw_parent":708,"Page":475,"fw_app":"driver","Menu_highlight_color":614,"vy":546,"delete_definition":673,"compute_layout":385,"move_candidate_to_front_of_manifest":632,"mouse_cursor":558,"keychord_press_on_manifest_navigator":675}

18
0709-update_editor_box Normal file
View File

@ -0,0 +1,18 @@
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
if node.editor.font_height ~= scale(20) then
edit.update_font_settings(node.editor, scale(20))
end
node.editor.left = math.floor(vx(node.x)) + Line_number_width*App.width(node.editor.em)
node.editor.right = math.ceil(vx(node.x+node.w))
end

1
0710-manifest Normal file
View File

@ -0,0 +1 @@
{"Mouse_cursor":559,"text_input_on_manifest_navigator":634,"manifest_coord":636,"manifest_index":637,"manifest_navigator_candidates":638,"Cursor_node":172,"add_def_to_menu":640,"order_of_magnitude":573,"approximate":579,"box_height":680,"on.draw":565,"font":353,"on.code_change":306,"Viewport":604,"on.initialize":695,"A":507,"Manifest_navigator":495,"B":379,"on.update":561,"on.keychord_press":666,"load_definition":682,"on":1,"initialize_editor":678,"get_manifest":706,"on.save_settings":702,"on.load_settings":700,"approximate_up":658,"Definitions":503,"new_definition":681,"table_and_array_both_empty":689,"maybe_update_key_in_definitions":529,"update_editor_box":710,"Surface":422,"scale":7,"on.mouse_release":554,"vx":545,"draw_cursor":639,"set_mouse_cursor":562,"schema1_of_y":667,"Menu_background_color":611,"draw_ticks":663,"Menu_border_color":612,"manifest_navigator_down":635,"Menu_command_color":613,"load_manifest":694,"y_of_schema1":364,"on_handle":547,"draw_menu_bar":641,"manifest_navigator_up":628,"add_hotkey_to_menu":616,"Manifest":494,"on_text":539,"draw_manifest_navigator":677,"on.mouse_press":617,"num_lines_for_manifest_navigator":676,"sy":469,"Ticks_font":669,"reset_manifest_navigator":621,"sx":544,"line_height":365,"load_from_iterator":670,"add_thick_line":400,"get_definition_from_app":624,"copy_shape":396,"tick_spec":660,"on.text_input":521,"on.key_release":552,"fw_parent":709,"Page":475,"fw_app":"driver","Menu_highlight_color":614,"vy":546,"delete_definition":673,"compute_layout":385,"move_candidate_to_front_of_manifest":632,"mouse_cursor":558,"keychord_press_on_manifest_navigator":675}

18
0710-update_editor_box Normal file
View File

@ -0,0 +1,18 @@
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
if node.editor.font_height ~= scale(20) then
edit.update_font_settings(node.editor, scale(20))
end
node.editor.left = math.floor(vx(node.x)) + Line_number_width*App.width(node.editor.em)
node.editor.right = math.ceil(vx(node.x+node.w))
end

1
0711-manifest Normal file
View File

@ -0,0 +1 @@
{"Mouse_cursor":559,"text_input_on_manifest_navigator":634,"manifest_coord":636,"manifest_index":637,"manifest_navigator_candidates":638,"Cursor_node":172,"add_def_to_menu":640,"order_of_magnitude":573,"approximate":579,"box_height":680,"on.draw":565,"font":353,"on.code_change":306,"Viewport":604,"on.initialize":695,"A":507,"Manifest_navigator":495,"B":379,"on.update":561,"on.keychord_press":666,"load_definition":682,"on":1,"initialize_editor":678,"get_manifest":706,"on.save_settings":702,"on.load_settings":700,"approximate_up":658,"Definitions":503,"new_definition":681,"table_and_array_both_empty":689,"maybe_update_key_in_definitions":529,"update_editor_box":711,"Surface":422,"scale":7,"on.mouse_release":554,"vx":545,"draw_cursor":639,"set_mouse_cursor":562,"schema1_of_y":667,"Menu_background_color":611,"draw_ticks":663,"Menu_border_color":612,"manifest_navigator_down":635,"Menu_command_color":613,"load_manifest":694,"y_of_schema1":364,"on_handle":547,"draw_menu_bar":641,"manifest_navigator_up":628,"add_hotkey_to_menu":616,"Manifest":494,"on_text":539,"draw_manifest_navigator":677,"on.mouse_press":617,"num_lines_for_manifest_navigator":676,"sy":469,"Ticks_font":669,"reset_manifest_navigator":621,"sx":544,"line_height":365,"load_from_iterator":670,"add_thick_line":400,"get_definition_from_app":624,"copy_shape":396,"tick_spec":660,"on.text_input":521,"on.key_release":552,"fw_parent":710,"Page":475,"fw_app":"driver","Menu_highlight_color":614,"vy":546,"delete_definition":673,"compute_layout":385,"move_candidate_to_front_of_manifest":632,"mouse_cursor":558,"keychord_press_on_manifest_navigator":675}

18
0711-update_editor_box Normal file
View File

@ -0,0 +1,18 @@
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
if node.editor.font_height ~= scale(20) then
edit.update_font_settings(node.editor, scale(20))
end
node.editor.left = math.floor(vx(node.x)) + Line_number_width*App.width(node.editor.em)
node.editor.right = math.ceil(vx(node.x+node.w))
end

1
0712-manifest Normal file
View File

@ -0,0 +1 @@
{"schema1_of_y":667,"order_of_magnitude":573,"load_definition":682,"on.draw":565,"on.mouse_release":554,"approximate":579,"Manifest":494,"Viewport":604,"on":1,"load_manifest":694,"on.save_settings":702,"on.load_settings":700,"approximate_up":658,"Definitions":503,"Ticks_font":669,"new_definition":681,"on.keychord_press":666,"Page":475,"add_thick_line":400,"copy_shape":396,"maybe_update_key_in_definitions":529,"draw_cursor":639,"Menu_background_color":611,"Menu_border_color":612,"Menu_command_color":613,"Menu_highlight_color":614,"draw_menu_bar":641,"line_height":365,"add_hotkey_to_menu":616,"on.code_change":306,"on_text":539,"num_lines_for_manifest_navigator":676,"on.mouse_press":617,"reset_manifest_navigator":621,"load_from_iterator":670,"fw_parent":711,"get_definition_from_app":624,"fw_app":"driver","manifest_navigator_up":628,"manifest_navigator_down":635,"delete_definition":673,"move_candidate_to_front_of_manifest":632,"keychord_press_on_manifest_navigator":675,"initialize_editor":678,"text_input_on_manifest_navigator":634,"vy":546,"manifest_coord":636,"manifest_index":637,"manifest_navigator_candidates":638,"A":507,"add_def_to_menu":640,"sx":544,"B":379,"mouse_cursor":558,"compute_layout":385,"on.update":561,"on.text_input":521,"draw_manifest_navigator":677,"on.key_release":552,"Manifest_navigator":495,"Cursor_node":172,"y_of_schema1":364,"box_height":680,"sy":469,"on.initialize":695,"scale":712,"Surface":422,"update_editor_box":711,"vx":545,"Mouse_cursor":559,"tick_spec":660,"get_manifest":706,"font":353,"set_mouse_cursor":562,"on_handle":547,"draw_ticks":663,"table_and_array_both_empty":689}

3
0712-scale Normal file
View File

@ -0,0 +1,3 @@
scale = function(d)
return d*Viewport.zoom
end

2
head
View File

@ -1 +1 @@
706
712