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C4LC2BE5PB42HK5PD6OYBNIDMAZBJASOKQC
KVHUFUFVOSY6GB4XI2QK4T4WCLIYOV3NZR67TX6AQHAQDWJMEOBQC
S7ZZA3YEKYGLBN6UC2N7WGUS43L6MX2KQQ2LBUZT4FQ7K7V5IQGQC
YT5P6TO64XSMCZGTT4SVNFOWUN5ECNXTWCMFXN3YCDZUNH4H3IFAC
2Y7YH7UPQWDNYDJN4BYY2MOHA36B2BIRX6DMIAKHJPQC7UP2R6NQC
3WNNXA6UXEX5GXO7UK3HR6GHJMKWZDRD246AEAI5F6IHOCGKDHYQC
BJ5X5O4ACBBJ56LRBBSTCW6IBQP4HAEOOOPNH3SKTA4F66YTOIDAC
VSBSWTE4IVQDRXLPQ7VTDIIEBEF7GMGRBHZ2IA73ZR6B2KZWI5JAC
if #arg > 0 then
Editor_state.filename = arg[1]
load_from_disk(Editor_state)
Text.redraw_all(Editor_state)
Editor_state.screen_top1 = {line=1, pos=1}
Editor_state.cursor1 = {line=1, pos=1}
edit.fixup_cursor(Editor_state)
else
load_from_disk(Editor_state)
Text.redraw_all(Editor_state)
if Editor_state.cursor1.line > #Editor_state.lines or Editor_state.lines[Editor_state.cursor1.line].mode ~= 'text' then
edit.fixup_cursor(Editor_state)
end
end
love.window.setTitle('lines.love - '..Editor_state.filename)
assert(#arg == 0)
Editor_state.file_path = os.date('%Y/%m/%d/%H-%M-%S')
Editor_state.filename = Editor_state.directory..Editor_state.file_path
Text.redraw_all(Editor_state)
os.execute('mkdir -p '..dirname(Editor_state.filename))
assert(not file_exists(Editor_state.filename))
function run.filedropped(file)
-- first make sure to save edits on any existing file
if Editor_state.next_save then
save_to_disk(Editor_state)
end
-- clear the slate for the new file
App.initialize_globals()
Editor_state.filename = file:getFilename()
file:open('r')
Editor_state.lines = load_from_file(file)
file:close()
Text.redraw_all(Editor_state)
edit.fixup_cursor(Editor_state)
love.window.setTitle('lines.love - '..Editor_state.filename)
end
assert(#arg == 0)
Editor_state.file_path = os.date('%Y/%m/%d/%H-%M-%S')
Editor_state.filename = Editor_state.directory..Editor_state.file_path
Text.redraw_all(Editor_state)
os.execute('mkdir -p '..dirname(Editor_state.filename))
assert(not file_exists(Editor_state.filename))
if Current_app == nil then
Current_app = 'run'
end
if Current_app == 'run' then
load_file_from_source_or_save_directory('file.lua')
load_file_from_source_or_save_directory('run.lua')
load_file_from_source_or_save_directory('edit.lua')
load_file_from_source_or_save_directory('text.lua')
load_file_from_source_or_save_directory('search.lua')
load_file_from_source_or_save_directory('select.lua')
load_file_from_source_or_save_directory('undo.lua')
load_file_from_source_or_save_directory('icons.lua')
load_file_from_source_or_save_directory('text_tests.lua')
load_file_from_source_or_save_directory('run_tests.lua')
load_file_from_source_or_save_directory('drawing.lua')
load_file_from_source_or_save_directory('geom.lua')
load_file_from_source_or_save_directory('help.lua')
load_file_from_source_or_save_directory('drawing_tests.lua')
else
load_file_from_source_or_save_directory('source_file.lua')
load_file_from_source_or_save_directory('source.lua')
load_file_from_source_or_save_directory('commands.lua')
load_file_from_source_or_save_directory('source_edit.lua')
load_file_from_source_or_save_directory('log_browser.lua')
load_file_from_source_or_save_directory('source_text.lua')
load_file_from_source_or_save_directory('search.lua')
load_file_from_source_or_save_directory('select.lua')
load_file_from_source_or_save_directory('source_undo.lua')
load_file_from_source_or_save_directory('colorize.lua')
load_file_from_source_or_save_directory('source_text_tests.lua')
load_file_from_source_or_save_directory('source_tests.lua')
end
function App.focus(in_focus)
if in_focus then
Last_focus_time = App.getTime()
end
if Current_app == 'run' then
if run.focus then run.focus(in_focus) end
elseif Current_app == 'source' then
if source.focus then source.focus(in_focus) end
else
assert(false, 'unknown app "'..Current_app..'"')
end
end
function App.keychord_pressed(chord, key)
-- ignore events for some time after window in focus (mostly alt-tab)
if App.getTime() < Last_focus_time + 0.01 then
return
end
--
if chord == 'C-e' then
-- carefully save settings
if Current_app == 'run' then
local source_settings = Settings.source
Settings = run.settings()
Settings.source = source_settings
if run.quit then run.quit() end
Current_app = 'source'
elseif Current_app == 'source' then
Settings.source = source.settings()
if source.quit then source.quit() end
Current_app = 'run'
else
assert(false, 'unknown app "'..Current_app..'"')
end
Settings.current_app = Current_app
love.filesystem.write('config', json.encode(Settings))
-- reboot
load_file_from_source_or_save_directory('main.lua')
App.undo_initialize()
App.run_tests_and_initialize()
return
if Current_app == 'run' then
if run.keychord_pressed then run.keychord_pressed(chord, key) end
elseif Current_app == 'source' then
if source.keychord_pressed then source.keychord_pressed(chord, key) end
else
assert(false, 'unknown app "'..Current_app..'"')
function App.focus(in_focus)
if in_focus then
Last_focus_time = App.getTime()
if Current_app == 'run' then
if run.focus then run.focus(in_focus) end
elseif Current_app == 'source' then
if source.focus then source.focus(in_focus) end
else
assert(false, 'unknown app "'..Current_app..'"')
end
if Current_app == nil then
Current_app = 'run'