Also tweak the scale to draw fewer tweaks.
KR33DR75FPD3WGIADGWUP6B6JAKZH5Q6OKIHKP4YD4KIVD3TI65QC ND6BDFN7SOG6MEQAYX34HFNKQ6JCAWG3GU5VFMICVQLJM4VCRRMQC GT3XZRTCVBWCSWUXAJ7N4OK2U2G5Y7EGSC5YE76KXZG7C4L53VTQC RME4YP33NNUXA7HCHKUMB7UTNVGUCBDU3AZW3TDUTYL2CFZMNGOQC OTIBCAUJ3KDQJLVDN3A536DLZGNRYMGJLORZVR3WLCGXGO6UGO6AC AVTNUQYRBW7IX2YQ3KDLVQ23RGW3BAKTAE7P73ASBYNKOHMQMH5AC LRDM35CEK3OHXOTB7TEFJRL7P6PQWO5ZG3F2BVA7DIDFHBPJQ7KAC Y6O2RFHV5UGHFS3ZZEH5HPKN5I7SV74GEV47MTI4WGJPAINJMBZAC R5QXEHUIZLELJGGCZAE7ATNS3CLRJ7JFRENMGH4XXH24C5WABZDQC Menu_background_color = {r=0.6, g=0.8, b=0.6}Menu_border_color = {r=0.6, g=0.7, b=0.6}Menu_command_color = {r=0.2, g=0.2, b=0.2}Menu_highlight_color = {r=0.5, g=0.7, b=0.3}function draw_menu_bar()if App.run_tests then return end -- disable in testsApp.color(Menu_background_color)love.graphics.rectangle('fill', 0,0, App.screen.width, Menu_bar_height)App.color(Menu_border_color)love.graphics.rectangle('line', 0,0, App.screen.width, Menu_bar_height)App.color(Menu_command_color)Menu_cursor = 5if Manifest_navigator.show thendraw_manifest_navigator()returnendadd_hotkey_to_menu('ctrl+l: load definition')add_hotkey_to_menu('ctrl+n: new definition')add_hotkey_to_menu('ctrl+d: delete definition')add_hotkey_to_menu('ctrl+f: find')add_hotkey_to_menu('ctrl+left ctrl+right: prev/next word')add_hotkey_to_menu('ctrl+z ctrl+y: undo/redo')add_hotkey_to_menu('ctrl+x ctrl+c ctrl+v: cut/copy/paste')add_hotkey_to_menu('ctrl+= ctrl+- ctrl+0: zoom')endfunction add_hotkey_to_menu(s)local s_text = to_hud_text(s)local width = App.width(s_text)if Menu_cursor > App.screen.width - 30 thenreturnendApp.color(Menu_command_color)App.screen.draw(s_text, Menu_cursor,5)Menu_cursor = Menu_cursor + width + 30endfunction load_from_iterator(f)local result = {}local i,line,drawing = 0, ''while true dolocal line = f()if line == nil then break endtable.insert(result, {data=line})endif #result == 0 thentable.insert(result, {data=''})endreturn resultendfunction draw_manifest_navigator()App.color(Menu_command_color)local filter_text = to_hud_text(Manifest_navigator.filter)App.screen.draw(filter_text, 5, 5)draw_cursor(5 + App.width(filter_text), 5)if Manifest_navigator.num_lines == nil thenManifest_navigator.num_lines = num_lines_for_manifest_navigator(Manifest_navigator.candidates)endApp.color(Menu_background_color)-- inefficient that we're computing this on every frame-- so look only in the topmost linelocal current_definition = live.get_cmd_from_buffer(Editor_state.lines[1].data)love.graphics.rectangle('fill', 0,Menu_bar_height, App.screen.width, Manifest_navigator.num_lines * (HUD_line_height + --[[highlight padding]]5) + --[[extra highlight padding for bottom]] 2)local x,y = 5, Menu_bar_heightfor i,definition in ipairs(Manifest_navigator.candidates) doif definition == current_definition thenif not Editor_state.saved thendefinition = definition..'*'endelseif Cached_definitions[definition] and not Cached_definitions[definition].saved thendefinition = definition..'*'endendx,y = add_def_to_menu(x,y, definition, i == Manifest_navigator.index)if Menu_cursor >= App.screen.width - 5 thenbreakendendManifest_navigator.bottom_y = y + HUD_line_height + --[[highlight padding]] 5endfunction draw_cursor(x, y)-- blink every 0.5sif math.floor(Cursor_time*2)%2 == 0 thenApp.color(Cursor_color)love.graphics.rectangle('fill', x,y, 3,HUD_line_height)endendfunction manifest_navigator_candidates()if Manifest_navigator.filter == '' thenreturn Manifestendlocal result = {}for _,def in ipairs(Manifest) doif starts_with(def, Manifest_navigator.filter) thentable.insert(result, def)endendreturn resultendfunction num_lines_for_manifest_navigator(candidates)local result = 1local x = 5for i,def in ipairs(candidates) dolocal width = App.width(to_hud_text(def))if x + width > App.screen.width - 5 thenresult = result+1x = 5 + widthelsex = x + width + 30endendreturn resultendfunction add_def_to_menu(x,y, s, cursor_highlight)local s_text = to_hud_text(s)local width = App.width(s_text)if x + width > App.screen.width - 5 theny = y + HUD_line_height + --[[highlight padding]] 5x = 5endlocal color = Menu_background_colorif cursor_highlight thencolor = Menu_highlight_colorendbutton(Editor_state, 'menu', {x=x-5, y=y-2, w=width+5*2, h=HUD_line_height+2*2, color=colortable(color),onpress1 = function()load_definition(s)end})App.color(Menu_command_color)App.screen.draw(s_text, x,y)x = x + width + 30return x,yendfunction reset_manifest_navigator()Manifest_navigator.show = falseManifest_navigator.index = 1Manifest_navigator.filter = ''Manifest_navigator.candidates = ManifestManifest_navigator.num_lines = num_lines_for_manifest_navigator(Manifest_navigator.candidates)endfunction keychord_press_on_manifest_navigator(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])endelseif 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()endendfunction load_definition(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()endfunction get_definition_from_app(name)live.send_to_app('GET '..name)local response_stringrepeatlove.timer.sleep(0.01)response_string = live.receive_from_app()until response_stringreturn response_stringendfunction move_candidate_to_front_of_manifest(name)local index = array.find(Manifest, name)if index thentable.remove(Manifest, index)table.insert(Manifest, 1, name)endendfunction delete_definition(name)live.send_to_app('DELETE '..name)Manifest_navigator.reload = truereset_manifest_navigator()endfunction manifest_navigator_up()local y, x, width = manifest_coord(Manifest_navigator.index)local index = manifest_index(y-HUD_line_height, x, width)if index thenManifest_navigator.index = indexendendfunction manifest_navigator_down()local y, x, width = manifest_coord(Manifest_navigator.index)local index = manifest_index(y+HUD_line_height, x, width)if index thenManifest_navigator.index = indexendendfunction manifest_coord(index)local y,x = Menu_bar_height, 5for i,definition in ipairs(Manifest_navigator.candidates) dolocal width = App.width(to_hud_text(definition))if x + width > App.screen.width - 5 theny = y + HUD_line_heightx = 5endif i == index thenreturn y, x, widthendx = x + width + 30endendfunction manifest_index(fy, fx, fwidth)local y,x = Menu_bar_height, 5local best_guess, best_guess_x, best_guess_widthfor i,definition in ipairs(Manifest_navigator.candidates) dolocal width = App.width(to_hud_text(definition))if x + width > App.screen.width - 5 theny = y + HUD_line_heightx = 5endif y == fy thenif best_guess == nil thenbest_guess = ibest_guess_x = xbest_guess_width = widthelseif math.abs(fx + fwidth/2 - x - width/2) < math.abs(fx + fwidth/2 - best_guess_x - best_guess_width/2) thenbest_guess = ibest_guess_x = xbest_guess_width = widthendendx = x + width + 30endreturn best_guessendfunction text_input_on_manifest_navigator(t)Manifest_navigator.filter = Manifest_navigator.filter..tManifest_navigator.candidates = manifest_navigator_candidates()Manifest_navigator.index = 1
load_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()
{"update_editor_box":570,"on.mouse_release":554,"Cursor_node":172,"get_manifest":497,"on.text_input":521,"copy_shape":396,"schema1_of_y":467,"Definitions":503,"new_definition":504,"Viewport":604,"box_height":345,"compute_layout":385,"Menu_highlight_color":614,"on.code_change":306,"reset_manifest_navigator":621,"keychord_press_on_manifest_navigator":633,"maybe_update_key_in_definitions":529,"delete_definition":631,"manifest_navigator_down":635,"manifest_navigator_up":628,"move_candidate_to_front_of_manifest":632,"draw_menu_bar":641,"Menu_background_color":611,"Menu_border_color":612,"Menu_command_color":613,"on_handle":547,"Manifest_navigator":495,"draw_manifest_navigator":618,"add_hotkey_to_menu":616,"on_text":539,"manifest_coord":636,"manifest_index":637,"sx":544,"vx":545,"vy":546,"Surface":422,"num_lines_for_manifest_navigator":619,"on.draw":565,"on.key_release":552,"add_def_to_menu":640,"manifest_navigator_candidates":638,"Manifest":494,"mouse_cursor":558,"Mouse_cursor":559,"on.update":561,"on.keychord_press":610,"font":353,"scale":7,"Page":475,"order_of_magnitude":573,"parent":641,"approximate":579,"sy":469,"approximate_up":583,"draw_cursor":639,"text_input_on_manifest_navigator":634,"set_mouse_cursor":562,"on":1,"Ticks_font":594,"y_of_schema1":364,"initialize_editor":450,"B":379,"load_from_iterator":623,"get_definition_from_app":624,"draw_ticks":642,"line_height":365,"A":507,"on.initialize":506,"on.mouse_press":617,"load_manifest":496,"add_thick_line":400}
draw_ticks = function()local old_font = love.graphics.getFont()love.graphics.setFont(Ticks_font)love.graphics.setColor(0.6,0.6,0.6)-- x axislocal lo, hi = Viewport.x, sx(App.screen.width)local anchorhi, scale = approximate(hi, order_of_magnitude(hi-lo))local anchorlo = approximate_up(lo, order_of_magnitude(hi-lo))if (anchorhi-anchorlo)/scale < 5 thenscale = scale/4elseif (anchorhi-anchorlo)/scale > 10 thenscale = scale*2.5endwhile vx(anchorlo-scale) > 0 doanchorlo = anchorlo-scaleendwhile vx(anchorhi+scale) < App.screen.width-20 doanchorhi = anchorhi+scaleendfor x=anchorlo,anchorhi,scale dolove.graphics.line(vx(x), Menu_bar_height, vx(x), Menu_bar_height+5)love.graphics.print(('%2.0f'):format(x), vx(x)+2, Menu_bar_height+5)love.graphics.line(vx(x), App.screen.height, vx(x), App.screen.height-5)love.graphics.print(('%2.0f'):format(x), vx(x)+2, App.screen.height-15)end-- y axislocal lo, hi = Viewport.y, sy(App.screen.height)local anchorhi, scale = approximate(hi, order_of_magnitude(hi-lo))local anchorlo = approximate_up(lo, order_of_magnitude(hi-lo))if (anchorhi-anchorlo)/scale < 5 thenscale = scale/2elseif (anchorhi-anchorlo)/scale > 10 thenscale = scale*2endwhile vy(anchorlo-scale) > Menu_bar_height+20 doanchorlo = anchorlo-scaleendwhile vy(anchorhi+scale) < App.screen.height-20 doanchorhi = anchorhi+scaleendfor y=anchorlo,anchorhi,scale dolove.graphics.line(0, vy(y), 5, vy(y))love.graphics.print(('%2.0f'):format(y), 5, vy(y)+2)love.graphics.line(App.screen.width, vy(y), App.screen.width-5, vy(y))love.graphics.print(('%2.0f'):format(y), App.screen.width-20, vy(y)+2)endlove.graphics.setFont(old_font)end
{"update_editor_box":570,"on.mouse_release":554,"Cursor_node":172,"get_manifest":497,"on.text_input":521,"copy_shape":396,"schema1_of_y":467,"Definitions":503,"new_definition":504,"Viewport":604,"box_height":345,"compute_layout":385,"Menu_highlight_color":614,"on.code_change":306,"reset_manifest_navigator":621,"keychord_press_on_manifest_navigator":633,"maybe_update_key_in_definitions":529,"delete_definition":631,"manifest_navigator_down":635,"manifest_navigator_up":628,"move_candidate_to_front_of_manifest":632,"draw_menu_bar":641,"Menu_background_color":611,"Menu_border_color":612,"Menu_command_color":613,"on_handle":547,"Manifest_navigator":495,"draw_manifest_navigator":618,"add_hotkey_to_menu":616,"on_text":539,"manifest_coord":636,"manifest_index":637,"sx":544,"vx":545,"vy":546,"Surface":422,"num_lines_for_manifest_navigator":619,"on.draw":565,"on.key_release":552,"add_def_to_menu":640,"manifest_navigator_candidates":638,"Manifest":494,"mouse_cursor":558,"Mouse_cursor":559,"on.update":561,"on.keychord_press":610,"font":353,"scale":7,"Page":475,"order_of_magnitude":573,"parent":640,"approximate":579,"sy":469,"approximate_up":583,"draw_cursor":639,"text_input_on_manifest_navigator":634,"set_mouse_cursor":562,"on":1,"Ticks_font":594,"y_of_schema1":364,"initialize_editor":450,"B":379,"load_from_iterator":623,"get_definition_from_app":624,"draw_ticks":609,"line_height":365,"A":507,"on.initialize":506,"on.mouse_press":617,"load_manifest":496,"add_thick_line":400}
draw_menu_bar = function()if App.run_tests then return end -- disable in testsApp.color(Menu_background_color)love.graphics.rectangle('fill', 0,0, App.screen.width, Menu_bar_height)App.color(Menu_border_color)love.graphics.rectangle('line', 0,0, App.screen.width, Menu_bar_height)App.color(Menu_command_color)Menu_cursor = 5if Manifest_navigator.show thendraw_manifest_navigator()returnendadd_hotkey_to_menu('ctrl+l: load definition')add_hotkey_to_menu('ctrl+n: new definition')add_hotkey_to_menu('ctrl+d: delete definition')add_hotkey_to_menu('ctrl+f: find')add_hotkey_to_menu('ctrl+left ctrl+right: prev/next word')add_hotkey_to_menu('ctrl+z ctrl+y: undo/redo')add_hotkey_to_menu('ctrl+x ctrl+c ctrl+v: cut/copy/paste')add_hotkey_to_menu('ctrl+= ctrl+- ctrl+0: zoom')end
{"update_editor_box":570,"on.mouse_release":554,"Cursor_node":172,"get_manifest":497,"on.text_input":521,"copy_shape":396,"schema1_of_y":467,"Definitions":503,"new_definition":504,"Viewport":604,"box_height":345,"compute_layout":385,"Menu_highlight_color":614,"on.code_change":306,"reset_manifest_navigator":621,"keychord_press_on_manifest_navigator":633,"maybe_update_key_in_definitions":529,"delete_definition":631,"manifest_navigator_down":635,"manifest_navigator_up":628,"move_candidate_to_front_of_manifest":632,"draw_menu_bar":615,"Menu_background_color":611,"Menu_border_color":612,"Menu_command_color":613,"on_handle":547,"Manifest_navigator":495,"draw_manifest_navigator":618,"add_hotkey_to_menu":616,"on_text":539,"manifest_coord":636,"manifest_index":637,"sx":544,"vx":545,"vy":546,"Surface":422,"num_lines_for_manifest_navigator":619,"on.draw":565,"on.key_release":552,"add_def_to_menu":640,"manifest_navigator_candidates":638,"Manifest":494,"mouse_cursor":558,"Mouse_cursor":559,"on.update":561,"on.keychord_press":610,"font":353,"scale":7,"Page":475,"order_of_magnitude":573,"parent":639,"approximate":579,"sy":469,"approximate_up":583,"draw_cursor":639,"text_input_on_manifest_navigator":634,"set_mouse_cursor":562,"on":1,"Ticks_font":594,"y_of_schema1":364,"initialize_editor":450,"B":379,"load_from_iterator":623,"get_definition_from_app":624,"draw_ticks":609,"line_height":365,"A":507,"on.initialize":506,"on.mouse_press":617,"load_manifest":496,"add_thick_line":400}
add_def_to_menu = function(x,y, s, cursor_highlight)local s_text = to_hud_text(s)local width = App.width(s_text)if x + width > App.screen.width - 5 theny = y + HUD_line_height + --[[highlight padding]] 5x = 5endlocal color = Menu_background_colorif cursor_highlight thencolor = Menu_highlight_colorendbutton(HUD, 'menu', {x=x-5, y=y-2, w=width+5*2, h=HUD_line_height+2*2, color=colortable(color),onpress1 = function()load_definition(s)end})App.color(Menu_command_color)App.screen.draw(s_text, x,y)x = x + width + 30return x,yend
{"update_editor_box":570,"on.mouse_release":554,"Cursor_node":172,"get_manifest":497,"on.text_input":521,"copy_shape":396,"schema1_of_y":467,"Definitions":503,"new_definition":504,"Viewport":604,"box_height":345,"compute_layout":385,"Menu_highlight_color":614,"on.code_change":306,"reset_manifest_navigator":621,"keychord_press_on_manifest_navigator":633,"maybe_update_key_in_definitions":529,"delete_definition":631,"manifest_navigator_down":635,"manifest_navigator_up":628,"move_candidate_to_front_of_manifest":632,"draw_menu_bar":615,"Menu_background_color":611,"Menu_border_color":612,"Menu_command_color":613,"on_handle":547,"Manifest_navigator":495,"draw_manifest_navigator":618,"add_hotkey_to_menu":616,"on_text":539,"manifest_coord":636,"manifest_index":637,"sx":544,"vx":545,"vy":546,"Surface":422,"num_lines_for_manifest_navigator":619,"on.draw":565,"on.key_release":552,"manifest_navigator_candidates":638,"Manifest":494,"mouse_cursor":558,"Mouse_cursor":559,"on.update":561,"on.keychord_press":610,"font":353,"scale":7,"Page":475,"order_of_magnitude":573,"parent":638,"approximate":579,"sy":469,"approximate_up":583,"draw_cursor":639,"text_input_on_manifest_navigator":634,"set_mouse_cursor":562,"on":1,"Ticks_font":594,"y_of_schema1":364,"initialize_editor":450,"B":379,"load_from_iterator":623,"get_definition_from_app":624,"draw_ticks":609,"line_height":365,"A":507,"on.initialize":506,"on.mouse_press":617,"load_manifest":496,"add_thick_line":400}
draw_cursor = function(x, y)-- blink every 0.5sif math.floor(Cursor_time*2)%2 == 0 thenApp.color(Cursor_color)love.graphics.rectangle('fill', x,y, 3,HUD_line_height)endend
manifest_navigator_candidates = function()if Manifest_navigator.filter == '' thenreturn Manifestendlocal result = {}for _,def in ipairs(Manifest) doif starts_with(def, Manifest_navigator.filter) thentable.insert(result, def)endendreturn resultend
{"update_editor_box":570,"on.mouse_release":554,"Cursor_node":172,"get_manifest":497,"on.text_input":521,"copy_shape":396,"schema1_of_y":467,"Definitions":503,"new_definition":504,"Viewport":604,"box_height":345,"compute_layout":385,"Menu_highlight_color":614,"on.code_change":306,"reset_manifest_navigator":621,"keychord_press_on_manifest_navigator":633,"maybe_update_key_in_definitions":529,"delete_definition":631,"manifest_navigator_down":635,"manifest_navigator_up":628,"move_candidate_to_front_of_manifest":632,"draw_menu_bar":615,"Menu_background_color":611,"Menu_border_color":612,"Menu_command_color":613,"on_handle":547,"Manifest_navigator":495,"draw_manifest_navigator":618,"add_hotkey_to_menu":616,"on_text":539,"manifest_coord":636,"manifest_index":637,"sx":544,"vx":545,"vy":546,"Surface":422,"num_lines_for_manifest_navigator":619,"on.draw":565,"on.key_release":552,"manifest_navigator_candidates":638,"Manifest":494,"mouse_cursor":558,"Mouse_cursor":559,"on.update":561,"on.keychord_press":610,"font":353,"scale":7,"Page":475,"order_of_magnitude":573,"parent":637,"approximate":579,"sy":469,"approximate_up":583,"text_input_on_manifest_navigator":634,"set_mouse_cursor":562,"on":1,"Ticks_font":594,"y_of_schema1":364,"initialize_editor":450,"B":379,"load_from_iterator":623,"get_definition_from_app":624,"draw_ticks":609,"line_height":365,"A":507,"on.initialize":506,"on.mouse_press":617,"load_manifest":496,"add_thick_line":400}
manifest_index = function(fy, fx, fwidth)local y,x = Menu_bar_height, 5local best_guess, best_guess_x, best_guess_widthfor i,definition in ipairs(Manifest_navigator.candidates) dolocal width = App.width(to_hud_text(definition))if x + width > App.screen.width - 5 theny = y + HUD_line_heightx = 5endif y == fy thenif best_guess == nil thenbest_guess = ibest_guess_x = xbest_guess_width = widthelseif math.abs(fx + fwidth/2 - x - width/2) < math.abs(fx + fwidth/2 - best_guess_x - best_guess_width/2) thenbest_guess = ibest_guess_x = xbest_guess_width = widthendendx = x + width + 30endreturn best_guessend
{"update_editor_box":570,"on.mouse_release":554,"Cursor_node":172,"get_manifest":497,"on.text_input":521,"copy_shape":396,"schema1_of_y":467,"Definitions":503,"new_definition":504,"Viewport":604,"box_height":345,"compute_layout":385,"Menu_highlight_color":614,"on.code_change":306,"reset_manifest_navigator":621,"keychord_press_on_manifest_navigator":633,"maybe_update_key_in_definitions":529,"delete_definition":631,"manifest_navigator_down":635,"manifest_navigator_up":628,"move_candidate_to_front_of_manifest":632,"draw_menu_bar":615,"Menu_background_color":611,"Menu_border_color":612,"Menu_command_color":613,"on_handle":547,"Manifest_navigator":495,"draw_manifest_navigator":618,"add_hotkey_to_menu":616,"on_text":539,"manifest_coord":636,"manifest_index":637,"sx":544,"vx":545,"vy":546,"Surface":422,"num_lines_for_manifest_navigator":619,"on.draw":565,"on.key_release":552,"Manifest":494,"mouse_cursor":558,"Mouse_cursor":559,"on.update":561,"on.keychord_press":610,"font":353,"scale":7,"Page":475,"order_of_magnitude":573,"parent":636,"approximate":579,"sy":469,"approximate_up":583,"text_input_on_manifest_navigator":634,"set_mouse_cursor":562,"on":1,"Ticks_font":594,"y_of_schema1":364,"initialize_editor":450,"B":379,"load_from_iterator":623,"get_definition_from_app":624,"draw_ticks":609,"line_height":365,"A":507,"on.initialize":506,"on.mouse_press":617,"load_manifest":496,"add_thick_line":400}
manifest_coord = function(index)local y,x = Menu_bar_height, 5for i,definition in ipairs(Manifest_navigator.candidates) dolocal width = App.width(to_hud_text(definition))if x + width > App.screen.width - 5 theny = y + HUD_line_heightx = 5endif i == index thenreturn y, x, widthendx = x + width + 30endend
{"update_editor_box":570,"on.mouse_release":554,"Cursor_node":172,"get_manifest":497,"on.text_input":521,"copy_shape":396,"schema1_of_y":467,"Definitions":503,"new_definition":504,"Viewport":604,"box_height":345,"compute_layout":385,"Menu_highlight_color":614,"on.code_change":306,"reset_manifest_navigator":621,"keychord_press_on_manifest_navigator":633,"maybe_update_key_in_definitions":529,"delete_definition":631,"manifest_navigator_down":635,"manifest_navigator_up":628,"move_candidate_to_front_of_manifest":632,"draw_menu_bar":615,"Menu_background_color":611,"Menu_border_color":612,"Menu_command_color":613,"on_handle":547,"Manifest_navigator":495,"draw_manifest_navigator":618,"add_hotkey_to_menu":616,"on_text":539,"manifest_coord":636,"sx":544,"vx":545,"vy":546,"Surface":422,"num_lines_for_manifest_navigator":619,"on.draw":565,"on.key_release":552,"Manifest":494,"mouse_cursor":558,"Mouse_cursor":559,"on.update":561,"on.keychord_press":610,"font":353,"scale":7,"Page":475,"order_of_magnitude":573,"parent":635,"approximate":579,"sy":469,"approximate_up":583,"text_input_on_manifest_navigator":634,"set_mouse_cursor":562,"on":1,"Ticks_font":594,"y_of_schema1":364,"initialize_editor":450,"B":379,"load_from_iterator":623,"get_definition_from_app":624,"draw_ticks":609,"line_height":365,"A":507,"on.initialize":506,"on.mouse_press":617,"load_manifest":496,"add_thick_line":400}
manifest_navigator_down = function()local y, x, width = manifest_coord(Manifest_navigator.index)local index = manifest_index(y+HUD_line_height, x, width)if index thenManifest_navigator.index = indexendend
{"update_editor_box":570,"on.mouse_release":554,"Cursor_node":172,"get_manifest":497,"on.text_input":521,"copy_shape":396,"schema1_of_y":467,"Definitions":503,"new_definition":504,"Viewport":604,"box_height":345,"compute_layout":385,"Menu_highlight_color":614,"on.code_change":306,"reset_manifest_navigator":621,"keychord_press_on_manifest_navigator":633,"maybe_update_key_in_definitions":529,"delete_definition":631,"manifest_navigator_down":635,"manifest_navigator_up":628,"move_candidate_to_front_of_manifest":632,"draw_menu_bar":615,"Menu_background_color":611,"Menu_border_color":612,"Menu_command_color":613,"on_handle":547,"Manifest_navigator":495,"draw_manifest_navigator":618,"add_hotkey_to_menu":616,"on_text":539,"sx":544,"vx":545,"vy":546,"Surface":422,"num_lines_for_manifest_navigator":619,"on.draw":565,"on.key_release":552,"Manifest":494,"mouse_cursor":558,"Mouse_cursor":559,"on.update":561,"on.keychord_press":610,"font":353,"scale":7,"Page":475,"order_of_magnitude":573,"parent":634,"approximate":579,"sy":469,"approximate_up":583,"text_input_on_manifest_navigator":634,"set_mouse_cursor":562,"on":1,"Ticks_font":594,"y_of_schema1":364,"initialize_editor":450,"B":379,"load_from_iterator":623,"get_definition_from_app":624,"draw_ticks":609,"line_height":365,"A":507,"on.initialize":506,"on.mouse_press":617,"load_manifest":496,"add_thick_line":400}
text_input_on_manifest_navigator = function(t)Manifest_navigator.filter = Manifest_navigator.filter..tManifest_navigator.candidates = manifest_navigator_candidates()Manifest_navigator.index = 1end
{"update_editor_box":570,"on.mouse_release":554,"Cursor_node":172,"get_manifest":497,"on.text_input":521,"copy_shape":396,"schema1_of_y":467,"Definitions":503,"new_definition":504,"Viewport":604,"box_height":345,"compute_layout":385,"Menu_highlight_color":614,"on.code_change":306,"reset_manifest_navigator":621,"keychord_press_on_manifest_navigator":633,"maybe_update_key_in_definitions":529,"delete_definition":631,"manifest_navigator_down":629,"manifest_navigator_up":628,"move_candidate_to_front_of_manifest":632,"draw_menu_bar":615,"Menu_background_color":611,"Menu_border_color":612,"Menu_command_color":613,"on_handle":547,"Manifest_navigator":495,"draw_manifest_navigator":618,"add_hotkey_to_menu":616,"on_text":539,"sx":544,"vx":545,"vy":546,"Surface":422,"num_lines_for_manifest_navigator":619,"on.draw":565,"on.key_release":552,"Manifest":494,"mouse_cursor":558,"Mouse_cursor":559,"on.update":561,"on.keychord_press":610,"font":353,"scale":7,"Page":475,"order_of_magnitude":573,"parent":633,"approximate":579,"sy":469,"approximate_up":583,"text_input_on_manifest_navigator":634,"set_mouse_cursor":562,"on":1,"Ticks_font":594,"y_of_schema1":364,"initialize_editor":450,"B":379,"load_from_iterator":623,"get_definition_from_app":624,"draw_ticks":609,"line_height":365,"A":507,"on.initialize":506,"on.mouse_press":617,"load_manifest":496,"add_thick_line":400}
{"update_editor_box":570,"on.mouse_release":554,"Cursor_node":172,"get_manifest":497,"on.text_input":521,"copy_shape":396,"schema1_of_y":467,"Definitions":503,"new_definition":504,"Viewport":604,"box_height":345,"compute_layout":385,"Menu_highlight_color":614,"on.code_change":306,"reset_manifest_navigator":621,"keychord_press_on_manifest_navigator":633,"maybe_update_key_in_definitions":529,"delete_definition":631,"manifest_navigator_down":629,"manifest_navigator_up":628,"move_candidate_to_front_of_manifest":632,"draw_menu_bar":615,"Menu_background_color":611,"Menu_border_color":612,"Menu_command_color":613,"on_handle":547,"Manifest_navigator":495,"draw_manifest_navigator":618,"add_hotkey_to_menu":616,"on_text":539,"sx":544,"vx":545,"vy":546,"Surface":422,"num_lines_for_manifest_navigator":619,"on.draw":565,"on.key_release":552,"Manifest":494,"mouse_cursor":558,"Mouse_cursor":559,"on.update":561,"on.keychord_press":610,"font":353,"scale":7,"Page":475,"order_of_magnitude":573,"parent":632,"approximate":579,"sy":469,"approximate_up":583,"set_mouse_cursor":562,"on":1,"Ticks_font":594,"y_of_schema1":364,"initialize_editor":450,"B":379,"load_from_iterator":623,"get_definition_from_app":624,"draw_ticks":609,"line_height":365,"A":507,"on.initialize":506,"on.mouse_press":617,"load_manifest":496,"add_thick_line":400}
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])endelseif 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
move_candidate_to_front_of_manifest = function(name)local index = array.find(Manifest, name)if index thentable.remove(Manifest, index)table.insert(Manifest, 1, name)endend
{"vx":545,"vy":546,"Surface":422,"update_editor_box":570,"num_lines_for_manifest_navigator":619,"on.draw":565,"on.key_release":552,"Cursor_node":172,"move_candidate_to_front_of_manifest":632,"get_manifest":497,"on.text_input":521,"copy_shape":396,"schema1_of_y":467,"add_thick_line":400,"parent":631,"mouse_cursor":558,"Definitions":503,"Mouse_cursor":559,"new_definition":504,"on_handle":547,"Viewport":604,"on.update":561,"load_manifest":496,"on.keychord_press":610,"font":353,"box_height":345,"scale":7,"compute_layout":385,"Menu_highlight_color":614,"on.mouse_press":617,"on.code_change":306,"reset_manifest_navigator":621,"order_of_magnitude":573,"maybe_update_key_in_definitions":529,"delete_definition":631,"on.initialize":506,"A":507,"manifest_navigator_down":629,"manifest_navigator_up":628,"on.mouse_release":554,"add_hotkey_to_menu":616,"line_height":365,"draw_ticks":609,"sy":469,"Menu_border_color":612,"Menu_command_color":613,"approximate_up":583,"draw_menu_bar":615,"Menu_background_color":611,"get_definition_from_app":624,"load_from_iterator":623,"Ticks_font":594,"Manifest_navigator":495,"B":379,"draw_manifest_navigator":618,"initialize_editor":450,"on_text":539,"y_of_schema1":364,"Page":475,"approximate":579,"on":1,"set_mouse_cursor":562,"sx":544,"Manifest":494}
{"vx":545,"vy":546,"Surface":422,"update_editor_box":570,"num_lines_for_manifest_navigator":619,"on.draw":565,"on.key_release":552,"Cursor_node":172,"get_manifest":497,"on.text_input":521,"copy_shape":396,"schema1_of_y":467,"delete_definition":631,"manifest_navigator_down":629,"mouse_cursor":558,"Definitions":503,"Mouse_cursor":559,"new_definition":504,"Manifest":494,"Viewport":604,"on.update":561,"get_definition_from_app":624,"on.keychord_press":610,"font":353,"box_height":345,"scale":7,"compute_layout":385,"Menu_highlight_color":614,"load_from_iterator":623,"on.code_change":306,"reset_manifest_navigator":621,"order_of_magnitude":573,"maybe_update_key_in_definitions":529,"parent":630,"set_mouse_cursor":562,"on":1,"approximate":579,"manifest_navigator_up":628,"initialize_editor":450,"Page":475,"y_of_schema1":364,"on.mouse_release":554,"sy":469,"line_height":365,"B":379,"approximate_up":583,"draw_menu_bar":615,"Menu_background_color":611,"Menu_border_color":612,"Menu_command_color":613,"Ticks_font":594,"Manifest_navigator":495,"draw_ticks":609,"draw_manifest_navigator":618,"add_hotkey_to_menu":616,"on_text":539,"A":507,"on.initialize":506,"on.mouse_press":617,"load_manifest":496,"on_handle":547,"sx":544,"add_thick_line":400}
delete_definition = function(name)live.send_to_app('DELETE '..name)Manifest_navigator.reload = truereset_manifest_navigator()end
{"vx":545,"vy":546,"Surface":422,"update_editor_box":570,"num_lines_for_manifest_navigator":619,"on.draw":565,"on.key_release":552,"Cursor_node":172,"get_manifest":497,"on.text_input":521,"copy_shape":396,"schema1_of_y":467,"manifest_navigator_down":629,"mouse_cursor":558,"Definitions":503,"Mouse_cursor":559,"new_definition":504,"Manifest":494,"Viewport":604,"on.update":561,"get_definition_from_app":624,"on.keychord_press":610,"font":353,"box_height":345,"scale":7,"compute_layout":385,"Menu_highlight_color":614,"load_from_iterator":623,"on.code_change":306,"reset_manifest_navigator":621,"order_of_magnitude":573,"maybe_update_key_in_definitions":529,"parent":629,"set_mouse_cursor":562,"on":1,"approximate":579,"manifest_navigator_up":628,"initialize_editor":450,"Page":475,"y_of_schema1":364,"on.mouse_release":554,"sy":469,"line_height":365,"B":379,"approximate_up":583,"draw_menu_bar":615,"Menu_background_color":611,"Menu_border_color":612,"Menu_command_color":613,"Ticks_font":594,"Manifest_navigator":495,"draw_ticks":609,"draw_manifest_navigator":618,"add_hotkey_to_menu":616,"on_text":539,"A":507,"on.initialize":506,"on.mouse_press":617,"load_manifest":496,"on_handle":547,"sx":544,"add_thick_line":400}
manifest_navigator_down = function()local y, x, width = manifest_coord(Manifest_navigator.index)local index = manifest_index(y+HUD_line_height, x, width)if index thenManifest_navigator.index = indexendend
{"vx":545,"vy":546,"Surface":422,"update_editor_box":570,"num_lines_for_manifest_navigator":619,"on.draw":565,"on.key_release":552,"Cursor_node":172,"function":627,"get_manifest":497,"on.text_input":521,"copy_shape":396,"schema1_of_y":467,"manifest_navigator_down":629,"mouse_cursor":558,"Definitions":503,"Mouse_cursor":559,"new_definition":504,"Manifest":494,"Viewport":604,"on.update":561,"get_definition_from_app":624,"on.keychord_press":610,"font":353,"box_height":345,"scale":7,"compute_layout":385,"Menu_highlight_color":614,"load_from_iterator":623,"on.code_change":306,"reset_manifest_navigator":621,"order_of_magnitude":573,"maybe_update_key_in_definitions":529,"parent":628,"set_mouse_cursor":562,"on":1,"approximate":579,"manifest_navigator_up":628,"initialize_editor":450,"Page":475,"y_of_schema1":364,"on.mouse_release":554,"sy":469,"line_height":365,"B":379,"approximate_up":583,"draw_menu_bar":615,"Menu_background_color":611,"Menu_border_color":612,"Menu_command_color":613,"Ticks_font":594,"Manifest_navigator":495,"draw_ticks":609,"draw_manifest_navigator":618,"add_hotkey_to_menu":616,"on_text":539,"A":507,"on.initialize":506,"on.mouse_press":617,"load_manifest":496,"on_handle":547,"sx":544,"add_thick_line":400}
manifest_navigator_up = function()local y, x, width = manifest_coord(Manifest_navigator.index)local index = manifest_index(y-HUD_line_height, x, width)if index thenManifest_navigator.index = indexendend
{"vx":545,"vy":546,"Surface":422,"update_editor_box":570,"num_lines_for_manifest_navigator":619,"on.draw":565,"on.key_release":552,"Cursor_node":172,"function":627,"get_manifest":497,"on.text_input":521,"copy_shape":396,"schema1_of_y":467,"mouse_cursor":558,"Definitions":503,"Mouse_cursor":559,"new_definition":504,"Manifest":494,"Viewport":604,"on.update":561,"get_definition_from_app":624,"on.keychord_press":610,"font":353,"box_height":345,"scale":7,"compute_layout":385,"Menu_highlight_color":614,"load_from_iterator":623,"on.code_change":306,"reset_manifest_navigator":621,"order_of_magnitude":573,"maybe_update_key_in_definitions":529,"parent":627,"set_mouse_cursor":562,"on":1,"approximate":579,"manifest_navigator_up":628,"initialize_editor":450,"Page":475,"y_of_schema1":364,"on.mouse_release":554,"sy":469,"line_height":365,"B":379,"approximate_up":583,"draw_menu_bar":615,"Menu_background_color":611,"Menu_border_color":612,"Menu_command_color":613,"Ticks_font":594,"Manifest_navigator":495,"draw_ticks":609,"draw_manifest_navigator":618,"add_hotkey_to_menu":616,"on_text":539,"A":507,"on.initialize":506,"on.mouse_press":617,"load_manifest":496,"on_handle":547,"sx":544,"add_thick_line":400}
{"vx":545,"vy":546,"Surface":422,"update_editor_box":570,"num_lines_for_manifest_navigator":619,"on.draw":565,"on.key_release":552,"Cursor_node":172,"function":627,"get_manifest":497,"on.text_input":521,"copy_shape":396,"schema1_of_y":467,"mouse_cursor":558,"Definitions":503,"Mouse_cursor":559,"new_definition":504,"Viewport":604,"on.update":561,"get_definition_from_app":624,"on.keychord_press":610,"font":353,"box_height":345,"scale":7,"compute_layout":385,"Menu_highlight_color":614,"load_from_iterator":623,"on.code_change":306,"reset_manifest_navigator":621,"order_of_magnitude":573,"maybe_update_key_in_definitions":529,"parent":626,"set_mouse_cursor":562,"on":1,"approximate":579,"Manifest":494,"initialize_editor":450,"Page":475,"y_of_schema1":364,"on.mouse_release":554,"sy":469,"line_height":365,"B":379,"approximate_up":583,"draw_menu_bar":615,"Menu_background_color":611,"Menu_border_color":612,"Menu_command_color":613,"Ticks_font":594,"Manifest_navigator":495,"draw_ticks":609,"draw_manifest_navigator":618,"add_hotkey_to_menu":616,"on_text":539,"A":507,"on.initialize":506,"on.mouse_press":617,"load_manifest":496,"on_handle":547,"sx":544,"add_thick_line":400}
function manifest_navigator_up()local y, x, width = manifest_coord(Manifest_navigator.index)local index = manifest_index(y-HUD_line_height, x, width)if index thenManifest_navigator.index = indexendend
{"vx":545,"vy":546,"Surface":422,"update_editor_box":570,"num_lines_for_manifest_navigator":619,"on.draw":565,"on.key_release":552,"Cursor_node":172,"function":626,"get_manifest":497,"on.text_input":521,"copy_shape":396,"schema1_of_y":467,"mouse_cursor":558,"Definitions":503,"Mouse_cursor":559,"new_definition":504,"Viewport":604,"on.update":561,"get_definition_from_app":624,"on.keychord_press":610,"font":353,"box_height":345,"scale":7,"compute_layout":385,"Menu_highlight_color":614,"load_from_iterator":623,"on.code_change":306,"reset_manifest_navigator":621,"order_of_magnitude":573,"maybe_update_key_in_definitions":529,"parent":625,"set_mouse_cursor":562,"on":1,"approximate":579,"Manifest":494,"initialize_editor":450,"Page":475,"y_of_schema1":364,"on.mouse_release":554,"sy":469,"line_height":365,"B":379,"approximate_up":583,"draw_menu_bar":615,"Menu_background_color":611,"Menu_border_color":612,"Menu_command_color":613,"Ticks_font":594,"Manifest_navigator":495,"draw_ticks":609,"draw_manifest_navigator":618,"add_hotkey_to_menu":616,"on_text":539,"A":507,"on.initialize":506,"on.mouse_press":617,"load_manifest":496,"on_handle":547,"sx":544,"add_thick_line":400}
function delete_definition(name)live.send_to_app('DELETE '..name)Manifest_navigator.reload = truereset_manifest_navigator()end
{"vx":545,"vy":546,"Surface":422,"update_editor_box":570,"num_lines_for_manifest_navigator":619,"on.draw":565,"on.key_release":552,"Cursor_node":172,"function":625,"get_manifest":497,"on.text_input":521,"copy_shape":396,"schema1_of_y":467,"mouse_cursor":558,"Definitions":503,"Mouse_cursor":559,"new_definition":504,"Viewport":604,"on.update":561,"get_definition_from_app":624,"on.keychord_press":610,"font":353,"box_height":345,"scale":7,"compute_layout":385,"Menu_highlight_color":614,"load_from_iterator":623,"on.code_change":306,"reset_manifest_navigator":621,"order_of_magnitude":573,"maybe_update_key_in_definitions":529,"parent":624,"set_mouse_cursor":562,"on":1,"approximate":579,"Manifest":494,"initialize_editor":450,"Page":475,"y_of_schema1":364,"on.mouse_release":554,"sy":469,"line_height":365,"B":379,"approximate_up":583,"draw_menu_bar":615,"Menu_background_color":611,"Menu_border_color":612,"Menu_command_color":613,"Ticks_font":594,"Manifest_navigator":495,"draw_ticks":609,"draw_manifest_navigator":618,"add_hotkey_to_menu":616,"on_text":539,"A":507,"on.initialize":506,"on.mouse_press":617,"load_manifest":496,"on_handle":547,"sx":544,"add_thick_line":400}
function move_candidate_to_front_of_manifest(name)local index = array.find(Manifest, name)if index thentable.remove(Manifest, index)table.insert(Manifest, 1, name)endend
{"vx":545,"vy":546,"Surface":422,"update_editor_box":570,"num_lines_for_manifest_navigator":619,"on.draw":565,"on.key_release":552,"Cursor_node":172,"function":622,"get_manifest":497,"on.text_input":521,"copy_shape":396,"schema1_of_y":467,"mouse_cursor":558,"Definitions":503,"Mouse_cursor":559,"new_definition":504,"Viewport":604,"on.update":561,"get_definition_from_app":624,"on.keychord_press":610,"font":353,"box_height":345,"scale":7,"compute_layout":385,"Menu_highlight_color":614,"load_from_iterator":623,"on.code_change":306,"reset_manifest_navigator":621,"order_of_magnitude":573,"maybe_update_key_in_definitions":529,"parent":623,"set_mouse_cursor":562,"on":1,"approximate":579,"Manifest":494,"initialize_editor":450,"Page":475,"y_of_schema1":364,"on.mouse_release":554,"sy":469,"line_height":365,"B":379,"approximate_up":583,"draw_menu_bar":615,"Menu_background_color":611,"Menu_border_color":612,"Menu_command_color":613,"Ticks_font":594,"Manifest_navigator":495,"draw_ticks":609,"draw_manifest_navigator":618,"add_hotkey_to_menu":616,"on_text":539,"A":507,"on.initialize":506,"on.mouse_press":617,"load_manifest":496,"on_handle":547,"sx":544,"add_thick_line":400}
get_definition_from_app = function(name)live.send_to_app('GET '..name)local response_stringrepeatlove.timer.sleep(0.01)response_string = live.receive_from_app()until response_stringreturn response_stringend
{"vx":545,"vy":546,"Surface":422,"update_editor_box":570,"num_lines_for_manifest_navigator":619,"on.draw":565,"on.key_release":552,"Cursor_node":172,"function":622,"get_manifest":497,"on.text_input":521,"copy_shape":396,"schema1_of_y":467,"mouse_cursor":558,"Definitions":503,"Mouse_cursor":559,"new_definition":504,"Viewport":604,"on.update":561,"on.keychord_press":610,"font":353,"box_height":345,"scale":7,"compute_layout":385,"Menu_highlight_color":614,"load_from_iterator":623,"on.code_change":306,"reset_manifest_navigator":621,"order_of_magnitude":573,"maybe_update_key_in_definitions":529,"parent":622,"set_mouse_cursor":562,"on":1,"approximate":579,"Manifest":494,"initialize_editor":450,"Page":475,"y_of_schema1":364,"on.mouse_release":554,"sy":469,"line_height":365,"B":379,"approximate_up":583,"draw_menu_bar":615,"Menu_background_color":611,"Menu_border_color":612,"Menu_command_color":613,"Ticks_font":594,"Manifest_navigator":495,"draw_ticks":609,"draw_manifest_navigator":618,"add_hotkey_to_menu":616,"on_text":539,"A":507,"on.initialize":506,"on.mouse_press":617,"load_manifest":496,"on_handle":547,"sx":544,"add_thick_line":400}
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, {data=line})endif #result == 0 thentable.insert(result, {data=''})endreturn resultend
{"vx":545,"vy":546,"Surface":422,"update_editor_box":570,"num_lines_for_manifest_navigator":619,"on.draw":565,"on.key_release":552,"Cursor_node":172,"function":622,"get_manifest":497,"on.text_input":521,"copy_shape":396,"schema1_of_y":467,"mouse_cursor":558,"Definitions":503,"Mouse_cursor":559,"new_definition":504,"Viewport":604,"on.update":561,"on.keychord_press":610,"font":353,"box_height":345,"scale":7,"compute_layout":385,"Menu_highlight_color":614,"on.code_change":306,"reset_manifest_navigator":621,"order_of_magnitude":573,"maybe_update_key_in_definitions":529,"parent":621,"set_mouse_cursor":562,"on":1,"approximate":579,"Manifest":494,"initialize_editor":450,"Page":475,"y_of_schema1":364,"on.mouse_release":554,"sy":469,"line_height":365,"B":379,"approximate_up":583,"draw_menu_bar":615,"Menu_background_color":611,"Menu_border_color":612,"Menu_command_color":613,"Ticks_font":594,"Manifest_navigator":495,"draw_ticks":609,"draw_manifest_navigator":618,"add_hotkey_to_menu":616,"on_text":539,"A":507,"on.initialize":506,"on.mouse_press":617,"load_manifest":496,"on_handle":547,"sx":544,"add_thick_line":400}
function keychord_press_on_manifest_navigator(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])endelseif 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
reset_manifest_navigator = function()Manifest_navigator.show = falseManifest_navigator.index = 1Manifest_navigator.filter = ''Manifest_navigator.candidates = ManifestManifest_navigator.num_lines = num_lines_for_manifest_navigator(Manifest_navigator.candidates)end
{"vx":545,"vy":546,"Surface":422,"update_editor_box":570,"num_lines_for_manifest_navigator":619,"on.draw":565,"on.key_release":552,"Cursor_node":172,"function":620,"get_manifest":497,"on.text_input":521,"copy_shape":396,"schema1_of_y":467,"mouse_cursor":558,"Definitions":503,"Mouse_cursor":559,"new_definition":504,"Viewport":604,"on.update":561,"on.keychord_press":610,"font":353,"box_height":345,"scale":7,"compute_layout":385,"Menu_highlight_color":614,"on.code_change":306,"reset_manifest_navigator":621,"order_of_magnitude":573,"maybe_update_key_in_definitions":529,"parent":620,"set_mouse_cursor":562,"on":1,"approximate":579,"Manifest":494,"initialize_editor":450,"Page":475,"y_of_schema1":364,"on.mouse_release":554,"sy":469,"line_height":365,"B":379,"approximate_up":583,"draw_menu_bar":615,"Menu_background_color":611,"Menu_border_color":612,"Menu_command_color":613,"Ticks_font":594,"Manifest_navigator":495,"draw_ticks":609,"draw_manifest_navigator":618,"add_hotkey_to_menu":616,"on_text":539,"A":507,"on.initialize":506,"on.mouse_press":617,"load_manifest":496,"on_handle":547,"sx":544,"add_thick_line":400}
{"vx":545,"vy":546,"Surface":422,"update_editor_box":570,"num_lines_for_manifest_navigator":619,"on.draw":565,"on.key_release":552,"Cursor_node":172,"function":620,"get_manifest":497,"on.text_input":521,"copy_shape":396,"schema1_of_y":467,"mouse_cursor":558,"Definitions":503,"Mouse_cursor":559,"new_definition":504,"Viewport":604,"on.update":561,"on.keychord_press":610,"font":353,"box_height":345,"scale":7,"compute_layout":385,"Menu_highlight_color":614,"on.code_change":306,"order_of_magnitude":573,"maybe_update_key_in_definitions":529,"parent":619,"set_mouse_cursor":562,"on":1,"approximate":579,"Manifest":494,"initialize_editor":450,"Page":475,"y_of_schema1":364,"on.mouse_release":554,"sy":469,"line_height":365,"B":379,"approximate_up":583,"draw_menu_bar":615,"Menu_background_color":611,"Menu_border_color":612,"Menu_command_color":613,"Ticks_font":594,"Manifest_navigator":495,"draw_ticks":609,"draw_manifest_navigator":618,"add_hotkey_to_menu":616,"on_text":539,"A":507,"on.initialize":506,"on.mouse_press":617,"load_manifest":496,"on_handle":547,"sx":544,"add_thick_line":400}
function text_input_on_manifest_navigator(t)Manifest_navigator.filter = Manifest_navigator.filter..tManifest_navigator.candidates = manifest_navigator_candidates()Manifest_navigator.index = 1end
num_lines_for_manifest_navigator = function(candidates)local result = 1local x = 5for i,def in ipairs(candidates) dolocal width = App.width(to_hud_text(def))if x + width > App.screen.width - 5 thenresult = result+1x = 5 + widthelsex = x + width + 30endendreturn resultend
{"vx":545,"vy":546,"Surface":422,"update_editor_box":570,"num_lines_for_manifest_navigator":619,"on.draw":565,"on.key_release":552,"Cursor_node":172,"get_manifest":497,"on.text_input":521,"copy_shape":396,"schema1_of_y":467,"mouse_cursor":558,"Definitions":503,"Mouse_cursor":559,"new_definition":504,"Viewport":604,"on.update":561,"on.keychord_press":610,"font":353,"box_height":345,"scale":7,"compute_layout":385,"Menu_highlight_color":614,"on.code_change":306,"order_of_magnitude":573,"maybe_update_key_in_definitions":529,"parent":618,"set_mouse_cursor":562,"on":1,"approximate":579,"Manifest":494,"initialize_editor":450,"Page":475,"y_of_schema1":364,"on.mouse_release":554,"sy":469,"line_height":365,"B":379,"approximate_up":583,"draw_menu_bar":615,"Menu_background_color":611,"Menu_border_color":612,"Menu_command_color":613,"Ticks_font":594,"Manifest_navigator":495,"draw_ticks":609,"draw_manifest_navigator":618,"add_hotkey_to_menu":616,"on_text":539,"A":507,"on.initialize":506,"on.mouse_press":617,"load_manifest":496,"on_handle":547,"sx":544,"add_thick_line":400}
{"vx":545,"vy":546,"Surface":422,"update_editor_box":570,"on.draw":565,"on.key_release":552,"Cursor_node":172,"get_manifest":497,"on.text_input":521,"copy_shape":396,"schema1_of_y":467,"mouse_cursor":558,"Definitions":503,"Mouse_cursor":559,"new_definition":504,"Viewport":604,"on.update":561,"on.keychord_press":610,"font":353,"box_height":345,"scale":7,"compute_layout":385,"Menu_highlight_color":614,"on.code_change":306,"order_of_magnitude":573,"maybe_update_key_in_definitions":529,"parent":617,"set_mouse_cursor":562,"on":1,"approximate":579,"Manifest":494,"initialize_editor":450,"Page":475,"y_of_schema1":364,"on.mouse_release":554,"sy":469,"line_height":365,"B":379,"approximate_up":583,"draw_menu_bar":615,"Menu_background_color":611,"Menu_border_color":612,"Menu_command_color":613,"Ticks_font":594,"Manifest_navigator":495,"draw_ticks":609,"draw_manifest_navigator":618,"add_hotkey_to_menu":616,"on_text":539,"A":507,"on.initialize":506,"on.mouse_press":617,"load_manifest":496,"on_handle":547,"sx":544,"add_thick_line":400}
draw_manifest_navigator = function()App.color(Menu_command_color)local filter_text = to_hud_text(Manifest_navigator.filter)App.screen.draw(filter_text, 5, 5)draw_cursor(5 + App.width(filter_text), 5)if Manifest_navigator.num_lines == nil thenManifest_navigator.num_lines = num_lines_for_manifest_navigator(Manifest_navigator.candidates)endApp.color(Menu_background_color)love.graphics.rectangle('fill', 0,Menu_bar_height, App.screen.width, Manifest_navigator.num_lines * (HUD_line_height + --[[highlight padding]]5) + --[[extra highlight padding for bottom]] 2)local x,y = 5, Menu_bar_heightfor i,definition in ipairs(Manifest_navigator.candidates) dox,y = add_def_to_menu(x,y, definition, i == Manifest_navigator.index)if Menu_cursor >= App.screen.width - 5 thenbreakendendManifest_navigator.bottom_y = y + HUD_line_height + --[[highlight padding]] 5end
on.mouse_press = function(x,y, mouse_button)if Cursor_node thenCursor_node.show_cursor = nilCursor_node = nilendif mouse_press_consumed_by_any_button_handler(HUD, x,y, mouse_button) thenreturnendlocal node = on_text(x,y)if node then-- position cursor in nodeCursor_node = nodeedit.mouse_press(node.editor, x,y, mouse_button)returnendlocal node = on_handle(x,y)if node then-- move nodeMove = {xoff=App.mouse_x()-vx(node.x), yoff=App.mouse_y()-vy(node.y), node=node}returnend-- pan surfacePan = {x=Viewport.x+x,y=Viewport.y+y}end
{"vx":545,"vy":546,"Surface":422,"update_editor_box":570,"on.draw":565,"on.key_release":552,"Cursor_node":172,"get_manifest":497,"on.text_input":521,"copy_shape":396,"schema1_of_y":467,"mouse_cursor":558,"Definitions":503,"Mouse_cursor":559,"new_definition":504,"Viewport":604,"on.update":561,"on.keychord_press":610,"font":353,"box_height":345,"scale":7,"compute_layout":385,"Menu_highlight_color":614,"on.code_change":306,"order_of_magnitude":573,"maybe_update_key_in_definitions":529,"parent":616,"on":1,"approximate":579,"Manifest":494,"initialize_editor":450,"Page":475,"y_of_schema1":364,"on.mouse_release":554,"sy":469,"line_height":365,"B":379,"approximate_up":583,"draw_menu_bar":615,"Menu_background_color":611,"Menu_border_color":612,"Menu_command_color":613,"Ticks_font":594,"Manifest_navigator":495,"draw_ticks":609,"set_mouse_cursor":562,"add_hotkey_to_menu":616,"on_text":539,"A":507,"on.initialize":506,"on.mouse_press":617,"load_manifest":496,"on_handle":547,"sx":544,"add_thick_line":400}
{"sy":469,"update_editor_box":570,"scale":7,"on.update":561,"on.keychord_press":610,"on_handle":547,"schema1_of_y":467,"Ticks_font":594,"font":353,"on_text":539,"Cursor_node":172,"on.mouse_press":556,"on.code_change":306,"sx":544,"add_hotkey_to_menu":616,"vx":545,"Surface":422,"Menu_background_color":611,"Menu_command_color":613,"load_manifest":496,"Menu_border_color":612,"get_manifest":497,"on.key_release":552,"Viewport":604,"Menu_highlight_color":614,"draw_menu_bar":615,"add_thick_line":400,"Manifest_navigator":495,"Definitions":503,"approximate_up":583,"new_definition":504,"compute_layout":385,"box_height":345,"vy":546,"on.initialize":506,"A":507,"parent":615,"set_mouse_cursor":562,"mouse_cursor":558,"draw_ticks":609,"B":379,"line_height":365,"copy_shape":396,"Mouse_cursor":559,"on.draw":565,"maybe_update_key_in_definitions":529,"approximate":579,"on.mouse_release":554,"order_of_magnitude":573,"y_of_schema1":364,"Page":475,"initialize_editor":450,"on.text_input":521,"Manifest":494,"on":1}
add_hotkey_to_menu = function(s)local s_text = to_hud_text(s)local width = App.width(s_text)if Menu_cursor > App.screen.width - 30 thenreturnendApp.color(Menu_command_color)App.screen.draw(s_text, Menu_cursor,5)Menu_cursor = Menu_cursor + width + 30end
{"sy":469,"update_editor_box":570,"scale":7,"on.update":561,"on.keychord_press":610,"on_handle":547,"schema1_of_y":467,"Ticks_font":594,"font":353,"on_text":539,"Cursor_node":172,"on.mouse_press":556,"on.code_change":306,"sx":544,"vx":545,"Surface":422,"Menu_background_color":611,"Menu_command_color":613,"load_manifest":496,"Menu_border_color":612,"get_manifest":497,"on.key_release":552,"Viewport":604,"Menu_highlight_color":614,"draw_menu_bar":615,"add_thick_line":400,"Manifest_navigator":495,"Definitions":503,"approximate_up":583,"new_definition":504,"compute_layout":385,"box_height":345,"vy":546,"on.initialize":506,"A":507,"parent":614,"set_mouse_cursor":562,"mouse_cursor":558,"draw_ticks":609,"B":379,"line_height":365,"copy_shape":396,"Mouse_cursor":559,"on.draw":565,"maybe_update_key_in_definitions":529,"approximate":579,"on.mouse_release":554,"order_of_magnitude":573,"y_of_schema1":364,"Page":475,"initialize_editor":450,"on.text_input":521,"Manifest":494,"on":1}
draw_menu_bar = function()if App.run_tests then return end -- disable in testsApp.color(Menu_background_color)love.graphics.rectangle('fill', 0,0, App.screen.width, Menu_bar_height)App.color(Menu_border_color)love.graphics.rectangle('line', 0,0, App.screen.width, Menu_bar_height)App.color(Menu_command_color)Menu_cursor = 5add_hotkey_to_menu('ctrl+l: load definition')add_hotkey_to_menu('ctrl+n: new definition')add_hotkey_to_menu('ctrl+d: delete definition')add_hotkey_to_menu('ctrl+f: find')add_hotkey_to_menu('ctrl+left ctrl+right: prev/next word')add_hotkey_to_menu('ctrl+z ctrl+y: undo/redo')add_hotkey_to_menu('ctrl+x ctrl+c ctrl+v: cut/copy/paste')add_hotkey_to_menu('ctrl+= ctrl+- ctrl+0: zoom')end
{"sy":469,"update_editor_box":570,"scale":7,"on.update":561,"on.keychord_press":610,"on_handle":547,"schema1_of_y":467,"Ticks_font":594,"font":353,"on_text":539,"Cursor_node":172,"on.mouse_press":556,"on.code_change":306,"sx":544,"vx":545,"Menu_background_color":611,"Menu_command_color":613,"load_manifest":496,"Menu_border_color":612,"get_manifest":497,"on.key_release":552,"Viewport":604,"Menu_highlight_color":614,"Surface":422,"add_thick_line":400,"Manifest_navigator":495,"Definitions":503,"approximate_up":583,"new_definition":504,"compute_layout":385,"box_height":345,"vy":546,"on.initialize":506,"A":507,"parent":613,"set_mouse_cursor":562,"mouse_cursor":558,"draw_ticks":609,"B":379,"line_height":365,"copy_shape":396,"Mouse_cursor":559,"on.draw":565,"maybe_update_key_in_definitions":529,"approximate":579,"on.mouse_release":554,"order_of_magnitude":573,"y_of_schema1":364,"Page":475,"initialize_editor":450,"on.text_input":521,"Manifest":494,"on":1}
Menu_highlight_color = {r=0.5, g=0.7, b=0.3}
{"sy":469,"update_editor_box":570,"scale":7,"on.update":561,"on.keychord_press":610,"on_handle":547,"schema1_of_y":467,"Ticks_font":594,"font":353,"on_text":539,"Cursor_node":172,"on.mouse_press":556,"on.code_change":306,"sx":544,"vx":545,"Menu_command_color":613,"load_manifest":496,"Menu_border_color":612,"get_manifest":497,"on.key_release":552,"Viewport":604,"Menu_background_color":611,"Surface":422,"add_thick_line":400,"Manifest_navigator":495,"Definitions":503,"approximate_up":583,"new_definition":504,"compute_layout":385,"box_height":345,"vy":546,"on.initialize":506,"A":507,"parent":612,"set_mouse_cursor":562,"mouse_cursor":558,"draw_ticks":609,"B":379,"line_height":365,"copy_shape":396,"Mouse_cursor":559,"on.draw":565,"maybe_update_key_in_definitions":529,"approximate":579,"on.mouse_release":554,"order_of_magnitude":573,"y_of_schema1":364,"Page":475,"initialize_editor":450,"on.text_input":521,"Manifest":494,"on":1}
Menu_command_color = {r=0.2, g=0.2, b=0.2}
{"sy":469,"update_editor_box":570,"scale":7,"on.update":561,"on.keychord_press":610,"on_handle":547,"schema1_of_y":467,"Ticks_font":594,"font":353,"on_text":539,"Cursor_node":172,"on.mouse_press":556,"on.code_change":306,"sx":544,"vx":545,"load_manifest":496,"Menu_border_color":612,"get_manifest":497,"on.key_release":552,"Viewport":604,"Menu_background_color":611,"Surface":422,"add_thick_line":400,"Manifest_navigator":495,"Definitions":503,"approximate_up":583,"new_definition":504,"compute_layout":385,"box_height":345,"vy":546,"on.initialize":506,"A":507,"parent":611,"set_mouse_cursor":562,"mouse_cursor":558,"draw_ticks":609,"B":379,"line_height":365,"copy_shape":396,"Mouse_cursor":559,"on.draw":565,"maybe_update_key_in_definitions":529,"approximate":579,"on.mouse_release":554,"order_of_magnitude":573,"y_of_schema1":364,"Page":475,"initialize_editor":450,"on.text_input":521,"Manifest":494,"on":1}
Menu_border_color = {r=0.6, g=0.7, b=0.6}
{"sy":469,"update_editor_box":570,"scale":7,"on.update":561,"on.keychord_press":610,"on_handle":547,"schema1_of_y":467,"Ticks_font":594,"font":353,"on_text":539,"Cursor_node":172,"on.mouse_press":556,"on.code_change":306,"sx":544,"vx":545,"load_manifest":496,"get_manifest":497,"on.key_release":552,"Viewport":604,"Menu_background_color":611,"Surface":422,"add_thick_line":400,"Manifest_navigator":495,"Definitions":503,"approximate_up":583,"new_definition":504,"compute_layout":385,"box_height":345,"vy":546,"on.initialize":506,"A":507,"parent":610,"set_mouse_cursor":562,"mouse_cursor":558,"draw_ticks":609,"B":379,"line_height":365,"copy_shape":396,"Mouse_cursor":559,"on.draw":565,"maybe_update_key_in_definitions":529,"approximate":579,"on.mouse_release":554,"order_of_magnitude":573,"y_of_schema1":364,"Page":475,"initialize_editor":450,"on.text_input":521,"Manifest":494,"on":1}
Menu_background_color = {r=0.6, g=0.8, b=0.6}