3DRVHB7C3UGLINVPVTGQ2YNIWER4GVVZRY7KUAZRXVFDV4Z2SXRQC
7D7J5J4X5EI5V7RAFUFIMK47OOPCMAEK6XPI5SFLFY3NQIHOSITAC
RJPNFXVQNSL6D7DPJYYTONKRZ5QR74FVGKCATSBPVM3KEAHU67QAC
LRG2TNA754SH2RLFUK5K3Y3XBWYR5FUVJGJZ6ZJXB3NJOKEP7M4AC
GVX7YSQYURPWFSUWVUAORZJTQBJURWWNBNUGEZYFAUMX3X5LSACQC
R5QXEHUIZLELJGGCZAE7ATNS3CLRJ7JFRENMGH4XXH24C5WABZDQC
HVXZLNCCLSMOKMA6TU7H7LKCRH5TAOP3X3EY6MEWFWZRWMVHEFWQC
W4EQ6IW4KVNJDAN32RUK7BLGWJB3TKZIE27PLIIGU5ARJPBMVS6QC
I52S4E5FT6E6FHH3QEDJPWO7C6W7AIMAFDP2KQ5FEWXFQX7RY6CAC
W3RRTO4PYRYYWVCL5FZFD7646E4WVPYAUVPCSCPI545EM74GY7EQC
OGDDLU5BOJEAETHLBI5S3HAOHI275IVIY5UOJ4TG6DROJJ5PIOLAC
GAKJROFZ5QBGUKTCAFC53JT5U2NYWVMUZHPYRALERQD7UUXSRHYAC
SIASJPGRZ55R5AY2Q7QO6CVBPVU5VHXQTSBWJQLXA3RAFFNBSHVQC
ZM7NOBRMD5HHA35Y4JDC76EOA2RD4KQOQCPURXYKXA6ABMKOJIGQC
rect('line', Safe_width-65, Menu_bottom+5, 30,30, 5)
line(Safe_width-60, Menu_bottom+20, Safe_width-40, Menu_bottom+20)
line(Safe_width-50, Menu_bottom+10, Safe_width-50, Menu_bottom+30)
rect('line', Safe_width-115, 5, 30,30, 5)
line(Safe_width-110, 20, Safe_width-90, 20)
line(Safe_width-100, 10, Safe_width-100, 30)
-- button to stop the app and return to the source editor
table.insert(widgets, {
draw = function()
color(0, 0.6,0.6)
g.setFont(Font)
local s = App.width('exit')
rect('line', Safe_width-s-15, 75, s+10,30, 5)
g.print('exit', Safe_width-s-10, 80)
end,
ispress = function(x2,y2)
g.setFont(Font)
local s = App.width('exit')
return x2 >= Safe_width-s-15 and y2 >= 75 and y2 <= 105
end,
press = stop_app,
})
stop_app = function()
clear_handlers()
Show_code = true
end
run_app = function()
-- ## run: initialize
clear_handlers()
edit.clear(Current_pane.output_editor_state)
print = print_to_output
-- ## run
local error = eval_all()
-- ## run: save some stuff, clean up the rest
if error == nil then
Show_code = nil
else
print = Real_print
clear_handlers()
-- could be either output or error
table.insert(Current_pane.output_editor_state.lines, {data=tostring(error)})
end
if #Current_pane.output_editor_state.lines == 0 then
table.insert(Current_pane.output_editor_state.lines, {data=''})
end
Text.redraw_all(Current_pane.output_editor_state)
end
-- ## run: initialize
clear_handlers()
local buf = table.concat(map(Current_pane.editor_state.lines, function(line) return line.data end), '\n')
edit.clear(Current_pane.output_editor_state)
print = print_to_output
-- ## run
local error = eval_all()
-- ## run: save some stuff, clean up the rest
if error == nil then
Show_code = nil
else
print = Real_print
clear_handlers()
-- could be either output or error
table.insert(Current_pane.output_editor_state.lines, {data=tostring(error)})
end
if #Current_pane.output_editor_state.lines == 0 then
table.insert(Current_pane.output_editor_state.lines, {data=''})
end
Text.redraw_all(Current_pane.output_editor_state)
run_app()