scenario: press ctrl+c app doesn't crash
SKDZZG2AOA5A4VHGDFTNDQZIXN6JELKFAZXI3MBPRKIX35DJNQZQC
on.keychord_press = function(chord, key)
assert(#Editors > 0)
if chord == 'C-0' then
initialize_editors( --[[font height]] 20, Editors[1].filename, Editors[1].screen_top1)
elseif chord == 'C-=' then
initialize_editors(Editors[1].font_height+2, Editors[1].filename, Editors[1].screen_top1)
elseif chord == 'C--' then
initialize_editors(Editors[1].font_height-2, Editors[1].filename, Editors[1].screen_top1)
else
for _,editor in ipairs(Editors) do
edit.keychord_press(editor, chord, key)
end
end
end
{"on.key_release":15,"Cursor_editor":16,"on.draw":12,"on.mouse_release":19,"on.mouse_press":20,"on.initialize":36,"Editors":6,"fw_parent":44,"on":1,"fw_app":"broadsheet","on.keychord_press":45,"initialize_editors":43}
on.keychord_press = function(chord, key)
assert(#Editors > 0)
if chord == 'C-0' then
initialize_editors( --[[font height]] 20, Editors[1].filename, Editors[1].screen_top1)
elseif chord == 'C-=' then
initialize_editors(Editors[1].font_height+2, Editors[1].filename, Editors[1].screen_top1)
elseif chord == 'C--' then
initialize_editors(Editors[1].font_height-2, Editors[1].filename, Editors[1].screen_top1)
else
print(chord)
for _,editor in ipairs(Editors) do
print(editor.selection1.line, editor.selection1.pos)
edit.keychord_press(editor, chord, key)
end
end
end
{"on.mouse_release":19,"on.key_release":15,"initialize_editors":43,"fw_parent":43,"on.initialize":36,"on":1,"on.draw":12,"Cursor_editor":16,"on.keychord_press":44,"Editors":6,"fw_app":"broadsheet","on.mouse_press":20}
initialize_editors = function(font_height, filename, screen_top)
Editors = {}
love.graphics.setFont(love.graphics.newFont(font_height))
-- initialize multiple editor widgets
local emwidth = App.newText(love.graphics.getFont(), 'm'):getWidth()
local editor_width = 40*emwidth
local width_remaining = App.screen.width - Margin_left - Margin_right
local left = Margin_left
repeat
local editor = edit.initialize_state(Margin_top, left, left + math.min(editor_width, width_remaining), font_height, math.floor(font_height*1.3))
table.insert(Editors, editor)
width_remaining = width_remaining - editor_width - Margin_left
left = left + editor_width + Margin_left
until width_remaining < editor_width
-- have them all operate on the file's lines
Editors[1].filename = filename
load_from_disk(Editors[1])
Text.redraw_all(Editors[1])
Editors[1].screen_top = screen_top
edit.draw(Editors[1], Text_color) -- initialize screen_bottom1
for e=2,#Editors do
local editor = Editors[e]
editor.lines = Editors[1].lines
editor.line_cache = Editors[1].line_cache
editor.screen_top1 = {line=Editors[e-1].screen_bottom1.line, pos=Editors[e-1].screen_bottom1.pos}
editor.cursor1 = {line=editor.screen_top1.line, pos=editor.screen_top1.pos}
edit.draw(editor, Text_color) -- initialize screen_bottom1
end
end
{"on.mouse_release":19,"on.key_release":15,"initialize_editors":43,"fw_parent":42,"on.initialize":36,"on":1,"on.draw":12,"Cursor_editor":16,"on.keychord_press":42,"Editors":6,"fw_app":"broadsheet","on.mouse_press":20}
on.keychord_press = function(chord, key)
assert(#Editors > 0)
local old_editor = Editors[1]
Editors = {}
if chord == 'C-0' then
initialize_editors( --[[font height]] 20, old_editor.filename, old_editor.screen_top1)
elseif chord == 'C-=' then
initialize_editors(old_editor.font_height+2, old_editor.filename, old_editor.screen_top1)
elseif chord == 'C--' then
initialize_editors(old_editor.font_height-2, old_editor.filename, old_editor.screen_top1)
else
print(chord)
for _,editor in ipairs(Editors) do
print(editor.selection1.line, editor.selection1.pos)
edit.keychord_press(editor, chord, key)
end
end
end
{"on.mouse_release":19,"on.key_release":15,"initialize_editors":35,"fw_parent":41,"on.initialize":36,"on":1,"on.draw":12,"Cursor_editor":16,"on.keychord_press":42,"Editors":6,"fw_app":"broadsheet","on.mouse_press":20}
on.keychord_press = function(chord, key)
assert(#Editors > 0)
local old_editor = Editors[1]
Editors = {}
if chord == 'C-0' then
initialize_editors( --[[font height]] 20, old_editor.filename, old_editor.screen_top1)
elseif chord == 'C-=' then
initialize_editors(old_editor.font_height+2, old_editor.filename, old_editor.screen_top1)
elseif chord == 'C--' then
initialize_editors(old_editor.font_height-2, old_editor.filename, old_editor.screen_top1)
else
for _,editor in ipairs(Editors) do
edit.keychord_press(editor, chord, key)
end
end
end
{"on.draw":12,"Cursor_editor":16,"on.mouse_press":20,"fw_parent":40,"on.mouse_release":19,"on.initialize":36,"Editors":6,"on":1,"fw_app":"broadsheet","on.keychord_press":41,"initialize_editors":35,"on.key_release":15}