This is needed in case a buffer has an error on the final line. Hitting enter would then hide the cursor behind the error.
Arguably we should do this for backspace as well, but recomputing the layout of the whole surface is expensive.
2RPK7DRUT4TC46JV22XF3JG2VX3MF3LKITVBORHE5L733LX42TIAC
on.keychord_press = function(chord, key)
print('key', chord)
if Animating then return end
if Move then return end
if Manifest_navigator.reload then
load_manifest()
end
if chord == 'C-=' then
-- zoom in
Viewport.zoom = Viewport.zoom+0.1
B()
elseif chord == 'C--' then
-- zoom out
if (Viewport.zoom-0.1)*20 >= 1 then -- disallow font size of 0
Viewport.zoom = Viewport.zoom-0.1
B()
end
elseif chord == 'C-0' then
-- reset zoom
Viewport.zoom = 1.0
B()
elseif chord == 'C-g' then
-- special Expose-like 'global zoom' mode
if Zoomed_out == nil then
zoom_out()
else
undo_zoom_out()
end
elseif chord == 'C-q' then
live.send_to_app('QUIT')
elseif Manifest_navigator.show then
keychord_press_on_manifest_navigator(chord, key)
elseif chord == 'C-n' then
new_definition()
A()
elseif chord == 'C-l' then
Manifest_navigator.show = true
Manifest_navigator.for_delete = false
initialize_manifest_navigator()
elseif chord == 'C-d' then
Manifest_navigator.show = true
Manifest_navigator.for_delete = true
initialize_manifest_navigator()
elseif Cursor_node then
local old_top = {line=Cursor_node.editor.screen_top1.line, pos=Cursor_node.editor.screen_top1.pos}
local old_definition_name = live.get_cmd_from_buffer(Cursor_node.editor.lines[1].data)
edit.keychord_press(Cursor_node.editor, chord, key)
if not eq(Cursor_node.editor.screen_top1, old_top) then
Viewport.y = Cursor_node.y + y_of_schema1(Cursor_node.editor, Cursor_node.editor.screen_top1)
end
local definition_name = live.get_cmd_from_buffer(Cursor_node.editor.lines[1].data)
maybe_update_key_in_definitions(old_definition_name, definition_name, Cursor_node)
if chord == 'return' then
A(--[[preserve screen_top of cursor node]] true)
else
B(--[[preserve screen_top of cursor node]] true)
end
else
if chord == 'up' then
Viewport.y = Viewport.y - scale(20)
B()
elseif chord == 'down' then
Viewport.y = Viewport.y + scale(20)
B()
elseif chord == 'left' then
Viewport.x = Viewport.x - scale(50)
B()
elseif chord == 'right' then
Viewport.x = Viewport.x + scale(50)
B()
elseif chord == 'pageup' then
Viewport.y = Viewport.y - App.screen.height/Viewport.zoom
B()
elseif chord == 'S-up' then
Viewport.y = Viewport.y - App.screen.height/Viewport.zoom
B()
elseif chord == 'pagedown' then
Viewport.y = Viewport.y + App.screen.height/Viewport.zoom
B()
elseif chord == 'S-down' then
Viewport.y = Viewport.y + App.screen.height/Viewport.zoom
B()
elseif chord == 'S-left' then
Viewport.x = Viewport.x - App.screen.width/Viewport.zoom
B()
elseif chord == 'S-right' then
Viewport.x = Viewport.x + App.screen.width/Viewport.zoom
B()
end
end
end
{"box_height":680,"move_candidate_to_front_of_manifest":632,"wait_for_response":781,"undo_zoom_out":921,"Cursor_node":172,"Failing_test_definition_background_color":925,"manifest_index":637,"on.text_input":855,"manifest_navigator_candidates":638,"load_definition":854,"update_editor_box":711,"add_def_to_menu":640,"draw_run_time_error":808,"get_default_map":937,"survey_animation":1014,"animate_next":914,"on_text":539,"y_of_schema1":364,"initialize_editor":678,"animate_next_frame":915,"sx":955,"iscale":953,"on.key_release":720,"test_approximate_up":983,"fw_parent":1020,"fw_app":"driver","Test_definition_background_color":858,"manifest_coord":636,"on.keychord_press":1021,"mouse_cursor":558,"Definition_background_color":849,"Mouse_cursor":559,"text_input_on_manifest_navigator":634,"load_manifest":694,"approximate":579,"Spawn_point":822,"keychord_press_on_manifest_navigator":765,"from_viewport":823,"sy":954,"interpolate_viewport":843,"add_thick_line":400,"surface_bounds":814,"copy_shape":396,"approximate_up":985,"A":1017,"vy":956,"order_of_magnitude":573,"scale":712,"Ticks_font":669,"definition_background_color":1015,"on.code_change":924,"on.mouse_release":836,"draw_load_time_error":929,"line_height":365,"load_from_iterator":670,"Zoomed_out":869,"Num_animation_frames":840,"draw_ticks":997,"B":1018,"set_mouse_cursor":562,"compute_layout":385,"Surface":422,"draw_test_failure_indicator":935,"on.save_settings":742,"Animating":842,"on":1,"draw_cursor":639,"table_and_array_both_empty":689,"Manifest_navigator":495,"tick_spec":998,"maybe_update_key_in_definitions":529,"on.initialize":948,"font":353,"Menu_background_color":611,"on_handle":547,"Menu_border_color":612,"add_hotkey_to_menu":616,"Menu_command_color":613,"Viewport":604,"Menu_highlight_color":614,"get_manifest":768,"draw_menu_bar":861,"on.draw":986,"Manifest":769,"vx":545,"snapshot_canvas":913,"draw_manifest_navigator":677,"Save_viewport":865,"num_lines_for_manifest_navigator":676,"copy_viewport":866,"on.code_submit":947,"reset_manifest_navigator":772,"zoom_out":908,"schema1_of_y":667,"on.mouse_press":916,"Definitions":503,"get_definition_from_app":784,"new_definition":848,"on.update":945,"initialize_manifest_navigator":773,"zoom_in":920,"manifest_navigator_up":628,"on.load_settings":1020,"manifest_navigator_down":635,"Page":475,"get_multiple_definitions_from_app":1016,"delete_definition":673}