From d830eff1a8928929b6960565b6a81fe2d96b481b Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Tue, 3 Jan 2023 03:15:03 -0800 Subject: [PATCH] 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. --- 0707-manifest | 1 + 0707-update_editor_box | 18 ++++++++++++++++++ 0708-manifest | 1 + 0708-update_editor_box | 18 ++++++++++++++++++ 0709-manifest | 1 + 0709-update_editor_box | 18 ++++++++++++++++++ 0710-manifest | 1 + 0710-update_editor_box | 18 ++++++++++++++++++ 0711-manifest | 1 + 0711-update_editor_box | 18 ++++++++++++++++++ 0712-manifest | 1 + 0712-scale | 3 +++ head | 2 +- 13 files changed, 100 insertions(+), 1 deletion(-) create mode 100644 0707-manifest create mode 100644 0707-update_editor_box create mode 100644 0708-manifest create mode 100644 0708-update_editor_box create mode 100644 0709-manifest create mode 100644 0709-update_editor_box create mode 100644 0710-manifest create mode 100644 0710-update_editor_box create mode 100644 0711-manifest create mode 100644 0711-update_editor_box create mode 100644 0712-manifest create mode 100644 0712-scale diff --git a/0707-manifest b/0707-manifest new file mode 100644 index 0000000..0f27983 --- /dev/null +++ b/0707-manifest @@ -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} \ No newline at end of file diff --git a/0707-update_editor_box b/0707-update_editor_box new file mode 100644 index 0000000..988da1b --- /dev/null +++ b/0707-update_editor_box @@ -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 \ No newline at end of file diff --git a/0708-manifest b/0708-manifest new file mode 100644 index 0000000..432298d --- /dev/null +++ b/0708-manifest @@ -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} \ No newline at end of file diff --git a/0708-update_editor_box b/0708-update_editor_box new file mode 100644 index 0000000..f1017ae --- /dev/null +++ b/0708-update_editor_box @@ -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 \ No newline at end of file diff --git a/0709-manifest b/0709-manifest new file mode 100644 index 0000000..727d8e1 --- /dev/null +++ b/0709-manifest @@ -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} \ No newline at end of file diff --git a/0709-update_editor_box b/0709-update_editor_box new file mode 100644 index 0000000..f1017ae --- /dev/null +++ b/0709-update_editor_box @@ -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 \ No newline at end of file diff --git a/0710-manifest b/0710-manifest new file mode 100644 index 0000000..de35534 --- /dev/null +++ b/0710-manifest @@ -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} \ No newline at end of file diff --git a/0710-update_editor_box b/0710-update_editor_box new file mode 100644 index 0000000..f1017ae --- /dev/null +++ b/0710-update_editor_box @@ -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 \ No newline at end of file diff --git a/0711-manifest b/0711-manifest new file mode 100644 index 0000000..6393c0a --- /dev/null +++ b/0711-manifest @@ -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} \ No newline at end of file diff --git a/0711-update_editor_box b/0711-update_editor_box new file mode 100644 index 0000000..f1017ae --- /dev/null +++ b/0711-update_editor_box @@ -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 \ No newline at end of file diff --git a/0712-manifest b/0712-manifest new file mode 100644 index 0000000..cca35b2 --- /dev/null +++ b/0712-manifest @@ -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} \ No newline at end of file diff --git a/0712-scale b/0712-scale new file mode 100644 index 0000000..22e97bb --- /dev/null +++ b/0712-scale @@ -0,0 +1,3 @@ +scale = function(d) + return d*Viewport.zoom +end \ No newline at end of file diff --git a/head b/head index 3873f56..3247896 100644 --- a/head +++ b/head @@ -1 +1 @@ -706 \ No newline at end of file +712 \ No newline at end of file