6LYD2XCQC5OXNX22M4DQWIFAMW2DWRZFAN2JV4MGDTYMMZXWPZRQC O4XAVDJWAM73TFGXRFXMB7Z4G2D4EQ6F2W6PY4SITYKGYF6ER7PQC R5QXEHUIZLELJGGCZAE7ATNS3CLRJ7JFRENMGH4XXH24C5WABZDQC GT3XZRTCVBWCSWUXAJ7N4OK2U2G5Y7EGSC5YE76KXZG7C4L53VTQC KR33DR75FPD3WGIADGWUP6B6JAKZH5Q6OKIHKP4YD4KIVD3TI65QC OWBGSQM3PQWLWZ55GKXM6YA2B626GTCYKZTAUPQZ2F62KNFDJX2QC OTIBCAUJ3KDQJLVDN3A536DLZGNRYMGJLORZVR3WLCGXGO6UGO6AC LRDM35CEK3OHXOTB7TEFJRL7P6PQWO5ZG3F2BVA7DIDFHBPJQ7KAC endload_definition = function(name)-- save current buffer locallylocal old_buffer = live.definition_to_string(Editor_state)if old_buffer:find('%s*%S') thenlocal old_definition_name = live.get_cmd_from_buffer(old_buffer)Cached_definitions[old_definition_name] = {saved=Editor_state.saved, data=old_buffer}end--if old_definition_name == name then return end -- don't clobber unsaved datamove_candidate_to_front_of_manifest(name)-- load new bufferEditor_state = edit.initialize_state(Menu_bar_height + Margin_top, Margin_left+Line_number_width, App.screen.width-Margin_right)local definition_string, savedif Cached_definitions[name] == nil then-- from appdefinition_string, saved = get_definition_from_app(name), trueelse-- from local storedefinition_string, saved = Cached_definitions[name].data, Cached_definitions[name].savedendEditor_state.lines = load_from_iterator(definition_string:gmatch("[^\r\n]+"))Editor_state.saved = savedText.redraw_all(Editor_state)Editor_state.font_height = Font_heightHUD_line_height = Line_heightEditor_state.em = emreset_manifest_navigator()
{"Ticks_font":669,"vy":546,"Manifest":494,"load_manifest":496,"get_manifest":497,"B":379,"Definitions":503,"new_definition":671,"Menu_background_color":611,"Menu_border_color":612,"text_input_on_manifest_navigator":634,"Menu_command_color":613,"Menu_highlight_color":614,"manifest_index":637,"Surface":422,"add_def_to_menu":640,"num_lines_for_manifest_navigator":619,"Cursor_node":172,"maybe_update_key_in_definitions":529,"on.keychord_press":666,"on":1,"on.text_input":521,"manifest_navigator_down":635,"delete_definition":673,"keychord_press_on_manifest_navigator":675,"tick_spec":660,"update_editor_box":570,"on.draw":565,"on_text":539,"schema1_of_y":667,"get_definition_from_app":624,"load_from_iterator":670,"on.mouse_press":617,"copy_shape":396,"y_of_schema1":364,"on.update":561,"on.key_release":552,"Page":475,"mouse_cursor":558,"line_height":365,"Mouse_cursor":559,"on.initialize":506,"initialize_editor":450,"load_definition":674,"set_mouse_cursor":562,"manifest_navigator_candidates":638,"draw_ticks":663,"font":353,"move_candidate_to_front_of_manifest":632,"draw_manifest_navigator":618,"manifest_coord":636,"draw_cursor":639,"manifest_navigator_up":628,"reset_manifest_navigator":621,"on.code_change":306,"order_of_magnitude":573,"A":507,"sy":469,"on.mouse_release":554,"box_height":345,"approximate":579,"compute_layout":385,"add_hotkey_to_menu":616,"draw_menu_bar":641,"scale":7,"Manifest_navigator":495,"parent":674,"add_thick_line":400,"Viewport":604,"approximate_up":658,"sx":544,"on_handle":547,"vx":545}
keychord_press_on_manifest_navigator = function(chord, key)if chord == 'escape' thenreset_manifest_navigator()elseif chord == 'return' thenif Manifest_navigator.delete thendelete_definition(Manifest_navigator.candidates[Manifest_navigator.index])elseload_definition(Manifest_navigator.candidates[Manifest_navigator.index])endA()reset_manifest_navigator()elseif chord == 'backspace' thenlocal len = utf8.len(Manifest_navigator.filter)local byte_offset = Text.offset(Manifest_navigator.filter, len)Manifest_navigator.filter = string.sub(Manifest_navigator.filter, 1, byte_offset-1)Manifest_navigator.index = 1Manifest_navigator.candidates = manifest_navigator_candidates()elseif chord == 'left' thenif Manifest_navigator.index > 1 thenManifest_navigator.index = Manifest_navigator.index-1endelseif chord == 'right' thenif Manifest_navigator.index < #Manifest_navigator.candidates thenManifest_navigator.index = Manifest_navigator.index+1endelseif chord == 'down' thenmanifest_navigator_down()elseif chord == 'up' thenmanifest_navigator_up()endend
{"Ticks_font":669,"vy":546,"Manifest":494,"load_manifest":496,"get_manifest":497,"B":379,"Definitions":503,"new_definition":671,"Menu_background_color":611,"Menu_border_color":612,"text_input_on_manifest_navigator":634,"Menu_command_color":613,"Menu_highlight_color":614,"manifest_index":637,"Surface":422,"add_def_to_menu":640,"num_lines_for_manifest_navigator":619,"Cursor_node":172,"maybe_update_key_in_definitions":529,"on.keychord_press":666,"on":1,"on.text_input":521,"manifest_navigator_down":635,"delete_definition":673,"keychord_press_on_manifest_navigator":672,"tick_spec":660,"update_editor_box":570,"on.draw":565,"on_text":539,"schema1_of_y":667,"get_definition_from_app":624,"load_from_iterator":670,"on.mouse_press":617,"copy_shape":396,"y_of_schema1":364,"on.update":561,"on.key_release":552,"Page":475,"mouse_cursor":558,"line_height":365,"Mouse_cursor":559,"on.initialize":506,"initialize_editor":450,"load_definition":674,"set_mouse_cursor":562,"manifest_navigator_candidates":638,"draw_ticks":663,"font":353,"move_candidate_to_front_of_manifest":632,"draw_manifest_navigator":618,"manifest_coord":636,"draw_cursor":639,"manifest_navigator_up":628,"reset_manifest_navigator":621,"on.code_change":306,"order_of_magnitude":573,"A":507,"sy":469,"on.mouse_release":554,"box_height":345,"approximate":579,"compute_layout":385,"add_hotkey_to_menu":616,"draw_menu_bar":641,"scale":7,"Manifest_navigator":495,"parent":673,"add_thick_line":400,"Viewport":604,"approximate_up":658,"sx":544,"on_handle":547,"vx":545}
load_definition = function(name)move_candidate_to_front_of_manifest(name)if Definitions[name] then return end -- just one copy per definition for nowDefinitions[name] = {type='text',data=load_from_iterator(get_definition_from_app(name):gmatch("[^\r\n]+")),x=0, y=0,width=400,bg={r=0.7,g=0.7,b=1},}end
{"Ticks_font":669,"vy":546,"Manifest":494,"load_manifest":496,"get_manifest":497,"B":379,"Definitions":503,"new_definition":671,"Menu_background_color":611,"Menu_border_color":612,"text_input_on_manifest_navigator":634,"Menu_command_color":613,"Menu_highlight_color":614,"manifest_index":637,"Surface":422,"add_def_to_menu":640,"num_lines_for_manifest_navigator":619,"Cursor_node":172,"maybe_update_key_in_definitions":529,"on.keychord_press":666,"on":1,"on.text_input":521,"manifest_navigator_down":635,"delete_definition":673,"keychord_press_on_manifest_navigator":672,"tick_spec":660,"update_editor_box":570,"on.draw":565,"on_text":539,"schema1_of_y":667,"get_definition_from_app":624,"load_from_iterator":670,"on.mouse_press":617,"copy_shape":396,"y_of_schema1":364,"on.update":561,"on.key_release":552,"Page":475,"mouse_cursor":558,"Mouse_cursor":559,"on.initialize":506,"initialize_editor":450,"line_height":365,"set_mouse_cursor":562,"manifest_navigator_candidates":638,"draw_ticks":663,"font":353,"move_candidate_to_front_of_manifest":632,"draw_manifest_navigator":618,"manifest_coord":636,"draw_cursor":639,"manifest_navigator_up":628,"reset_manifest_navigator":621,"on.code_change":306,"order_of_magnitude":573,"A":507,"sy":469,"on.mouse_release":554,"box_height":345,"approximate":579,"compute_layout":385,"add_hotkey_to_menu":616,"draw_menu_bar":641,"scale":7,"Manifest_navigator":495,"parent":672,"add_thick_line":400,"Viewport":604,"approximate_up":658,"sx":544,"on_handle":547,"vx":545}
delete_definition = function(name)live.send_to_app('DELETE '..name)Manifest_navigator.reload = trueend
{"Ticks_font":669,"vy":546,"Manifest":494,"load_manifest":496,"get_manifest":497,"B":379,"Definitions":503,"new_definition":671,"Menu_background_color":611,"Menu_border_color":612,"text_input_on_manifest_navigator":634,"Menu_command_color":613,"Menu_highlight_color":614,"manifest_index":637,"Surface":422,"add_def_to_menu":640,"num_lines_for_manifest_navigator":619,"Cursor_node":172,"maybe_update_key_in_definitions":529,"on.keychord_press":666,"on":1,"on.text_input":521,"manifest_navigator_down":635,"delete_definition":631,"keychord_press_on_manifest_navigator":672,"tick_spec":660,"update_editor_box":570,"on.draw":565,"on_text":539,"schema1_of_y":667,"get_definition_from_app":624,"load_from_iterator":670,"on.mouse_press":617,"copy_shape":396,"y_of_schema1":364,"on.update":561,"on.key_release":552,"Page":475,"mouse_cursor":558,"Mouse_cursor":559,"on.initialize":506,"initialize_editor":450,"line_height":365,"set_mouse_cursor":562,"manifest_navigator_candidates":638,"draw_ticks":663,"font":353,"move_candidate_to_front_of_manifest":632,"draw_manifest_navigator":618,"manifest_coord":636,"draw_cursor":639,"manifest_navigator_up":628,"reset_manifest_navigator":621,"on.code_change":306,"order_of_magnitude":573,"A":507,"sy":469,"on.mouse_release":554,"box_height":345,"approximate":579,"compute_layout":385,"add_hotkey_to_menu":616,"draw_menu_bar":641,"scale":7,"Manifest_navigator":495,"parent":671,"add_thick_line":400,"Viewport":604,"approximate_up":658,"sx":544,"on_handle":547,"vx":545}
keychord_press_on_manifest_navigator = function(chord, key)if chord == 'escape' thenreset_manifest_navigator()elseif chord == 'return' thenif Manifest_navigator.delete thendelete_definition(Manifest_navigator.candidates[Manifest_navigator.index])elseload_definition(Manifest_navigator.candidates[Manifest_navigator.index])endreset_manifest_navigator()elseif chord == 'backspace' thenlocal len = utf8.len(Manifest_navigator.filter)local byte_offset = Text.offset(Manifest_navigator.filter, len)Manifest_navigator.filter = string.sub(Manifest_navigator.filter, 1, byte_offset-1)Manifest_navigator.index = 1Manifest_navigator.candidates = manifest_navigator_candidates()elseif chord == 'left' thenif Manifest_navigator.index > 1 thenManifest_navigator.index = Manifest_navigator.index-1endelseif chord == 'right' thenif Manifest_navigator.index < #Manifest_navigator.candidates thenManifest_navigator.index = Manifest_navigator.index+1endelseif chord == 'down' thenmanifest_navigator_down()elseif chord == 'up' thenmanifest_navigator_up()endend
new_definition = function()table.insert(Definitions, {type='text',data={''},x=0, y=0,width=400,bg={r=0.7,g=0.7,b=1},})end
{"Ticks_font":669,"vy":546,"Manifest":494,"load_manifest":496,"get_manifest":497,"B":379,"Definitions":503,"new_definition":671,"Menu_background_color":611,"Menu_border_color":612,"text_input_on_manifest_navigator":634,"Menu_command_color":613,"Menu_highlight_color":614,"manifest_index":637,"Surface":422,"add_def_to_menu":640,"num_lines_for_manifest_navigator":619,"Cursor_node":172,"maybe_update_key_in_definitions":529,"on.keychord_press":666,"on":1,"on.text_input":521,"manifest_navigator_down":635,"delete_definition":631,"keychord_press_on_manifest_navigator":633,"tick_spec":660,"update_editor_box":570,"on.draw":565,"on_text":539,"schema1_of_y":667,"get_definition_from_app":624,"load_from_iterator":670,"on.mouse_press":617,"copy_shape":396,"y_of_schema1":364,"on.update":561,"on.key_release":552,"Page":475,"mouse_cursor":558,"Mouse_cursor":559,"on.initialize":506,"initialize_editor":450,"line_height":365,"set_mouse_cursor":562,"manifest_navigator_candidates":638,"draw_ticks":663,"font":353,"move_candidate_to_front_of_manifest":632,"draw_manifest_navigator":618,"manifest_coord":636,"draw_cursor":639,"manifest_navigator_up":628,"reset_manifest_navigator":621,"on.code_change":306,"order_of_magnitude":573,"A":507,"sy":469,"on.mouse_release":554,"box_height":345,"approximate":579,"compute_layout":385,"add_hotkey_to_menu":616,"draw_menu_bar":641,"scale":7,"Manifest_navigator":495,"parent":670,"add_thick_line":400,"Viewport":604,"approximate_up":658,"sx":544,"on_handle":547,"vx":545}
{"Ticks_font":669,"vy":546,"Manifest":494,"load_manifest":496,"get_manifest":497,"B":379,"Definitions":503,"new_definition":504,"Menu_background_color":611,"Menu_border_color":612,"text_input_on_manifest_navigator":634,"Menu_command_color":613,"Menu_highlight_color":614,"manifest_index":637,"Surface":422,"add_def_to_menu":640,"num_lines_for_manifest_navigator":619,"Cursor_node":172,"maybe_update_key_in_definitions":529,"on.keychord_press":666,"on":1,"on.text_input":521,"manifest_navigator_down":635,"delete_definition":631,"keychord_press_on_manifest_navigator":633,"tick_spec":660,"update_editor_box":570,"on.draw":565,"on_text":539,"schema1_of_y":667,"get_definition_from_app":624,"load_from_iterator":670,"on.mouse_press":617,"copy_shape":396,"y_of_schema1":364,"on.update":561,"on.key_release":552,"Page":475,"mouse_cursor":558,"Mouse_cursor":559,"on.initialize":506,"initialize_editor":450,"line_height":365,"set_mouse_cursor":562,"manifest_navigator_candidates":638,"draw_ticks":663,"font":353,"move_candidate_to_front_of_manifest":632,"draw_manifest_navigator":618,"manifest_coord":636,"draw_cursor":639,"manifest_navigator_up":628,"reset_manifest_navigator":621,"on.code_change":306,"order_of_magnitude":573,"A":507,"sy":469,"on.mouse_release":554,"box_height":345,"approximate":579,"compute_layout":385,"add_hotkey_to_menu":616,"draw_menu_bar":641,"scale":7,"Manifest_navigator":495,"parent":669,"add_thick_line":400,"Viewport":604,"approximate_up":658,"sx":544,"on_handle":547,"vx":545}
load_from_iterator = function(f)local result = {}local i,line,drawing = 0, ''while true dolocal line = f()if line == nil then break endtable.insert(result, line)endif #result == 0 thentable.insert(result, '')endreturn resultend