send errors from event handlers to output editor
Dependencies
- [2]
TOKSRJMDshow how to load lines in editor - [3]
GAKJROFZahh, got the background color sliders working - [4]
6DJMOJKEsupport event handlers - [5]
I52S4E5Frunning `print` now appends to output editor - [6]
JV27LDDKsliders for font size and color settings - [7]
WR2WMEPEimplement 'Run' button - [8]
IP4LD33Dmouse events for scrollbar - [9]
PRE6XPRNresponsively increase/decrease font height - [10]
Z5M23NTKimplement second, 'output' editor - [11]
RK2ASPN7add lots of buttons to the toolbar - [12]
ZM7NOBRMnew fork: carousel shell - [13]
4GX6NAY4some very basic animations for switching panes - [14]
VAVXKWZVaggregate global state inside a 'pane' object - [15]
ZOLCTAGUget rid of an assertion - [*]
N2NUGNN4include a brief reference enabling many useful apps - [*]
JNAQUQKBMerge lines.love - [*]
2L5MEZV3experiment: new edit namespace - [*]
R2ASHK5Cfix a bad merge - [*]
R5QXEHUIsomebody stop me - [*]
UEG224LHdebug animations
Change contents
- edit in reference.md at line 198
* `edit.clear_state(state)` -- empties the editor of any text it may contain. - edit in edit.lua at line 397
function edit.clear(State)State.lines = {{data=''}}Text.redraw_all(State)State.cursor1 = {line=1, pos=1}State.screen_top1 = {line=1, pos=1}end - file addition: 0105-clear_handlers[21.2]
clear_handlers = function()for k in pairs(car) docar[k] = nilendend - file addition: 0104-call_protected[21.2]
call_protected = function(f, ...)local args = {...}xpcall(function()f(unpack(args))end,send_errors_to_output)end - file addition: 0102-send_errors_to_output[21.2]
send_errors_to_output = function(err)local callstack = debug.traceback('', 3)local error_with_callstack = cleaned_up_frame(tostring(err))..'\n'..cleaned_up_callstack(callstack)Text.insert_text(Current_pane.output_editor_state, error_with_callstack)Text.redraw_all(Current_pane.output_editor_state)clear_handlers()end - replacement in 0101-on.mouse_wheel_move at line 6
if car.mouse_wheel_move then car.mouse_wheel_move(dx,dy) endif car.wheelmoved then car.wheelmoved(dx,dy) endif car.mouse_wheel_move thencall_protected(car.mouse_wheel_move, dx,dy)endif car.wheelmoved thencall_protected(car.wheelmoved, dx,dy)end - edit in 0051-run_button at line 11
clear_handlers() - replacement in 0051-run_button at line 17
Current_pane.output_editor_state.lines = {}Text.redraw_all(Current_pane.output_editor_state)edit.clear(Current_pane.output_editor_state) - replacement in 0051-run_button at line 21
local status, result = live.eval(buf)local status, result = live.eval(buf, 'editor') - replacement in 0017-on.mouse_release at line 19
if car.mouse_release then car.mouse_release(x,y, mouse_button) endif car.mousereleased then car.mousereleased(x,y, mouse_button) endif car.mouse_release thencall_protected(car.mouse_release, x,y, mouse_button)endif car.mousereleased thencall_protected(car.mousereleased, x,y, mouse_button)end - replacement in 0015-on.key_release at line 8
if car.key_release then car.key_release(key, scancode) endif car.keyreleased then car.keyreleased(key, scancode) endif car.key_release thencall_protected(car.key_release, key, scancode)endif car.keyreleased thencall_protected(car.keyreleased, key, scancode)end - replacement in 0014-on.text_input at line 8
if car.text_input then car.text_input(t) endif car.textinput then car.textinput(t) endif car.text_input thencall_protected(car.text_input, t)endif car.textinput thencall_protected(car.textinput, t)end - replacement in 0013-on.keychord_press at line 15
if car.keychord_press then car.keychord_press(chord, key) endif car.keypressed then car.keypressed(key) endif car.keychord_press thencall_protected(car.keychord_press, chord, key)endif car.keypressed thencall_protected(car.keypressed, key)end - replacement in 0012-on.draw at line 6
if car.draw then car.draw() end -- off canvasif car.draw then call_protected(car.draw) end -- off canvas - replacement in 0004-on.update at line 11
if car.update then car.update(dt) endif car.update then call_protected(car.update, dt) end