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LQC 34QHL4KCLCWXMXY7CBWZIEMKL6BX62DACWANNPQPYUHSV2INSE2QC QEXZHD2VPCM4TAPP7PR2K2PIR4BVES5IZWC3T6ZRNJWKWOXFILNQC MSOQI3A5BC5PY2MZXZQAQ4EQDT4KICQJPN3YUZVDYTWXSPZWBLIAC MUJTM6REGQAK3LZTIFWGJRXE2UPCM4HSLXQYSF5ITLXLS6JCVPMQC LXTTOB33N2HCUZFIUDRQGGBVHK2HODRG4NBLH6RXRQZDCHF27BSAC 5ZA3BRNYWKSGEBJ4JLA4UBC3LJPT5JBWYCU7PQYRSGX6MJMEWDIQC AMOPICKVRHMQERJLFPMAAEBV7TL5QACGGSBJWRCMV5R5O3KDVETAC endfunction dirname(path)local os_path_separator = package.config:sub(1,1)if os_path_separator == '/' then-- POSIX systems permit backslashes in filenamesreturn path:match('.*/') or './'elseif os_path_separator == '\\' thenreturn path:match('.*[/\\]') or './'elseerror('What OS is this? LÖVE reports that the path separator is "'..os_path_separator..'"')endendfunction test_dirname()check_eq(dirname('a/b'), 'a/', 'F - test_dirname')check_eq(dirname('x'), './', 'F - test_dirname/current')endfunction basename(path)local os_path_separator = package.config:sub(1,1)if os_path_separator == '/' then-- POSIX systems permit backslashes in filenamesreturn string.gsub(path, ".*/(.*)", "%1")elseif os_path_separator == '\\' thenreturn string.gsub(path, ".*[/\\](.*)", "%1")elseerror('What OS is this? LÖVE reports that the path separator is "'..os_path_separator..'"')endfunction empty(h)for _,_ in pairs(h) doreturn falseendreturn trueendend
File_navigation.cursors[Editor_state.filename] = {cursor1=Editor_state.cursor1, screen_top1=Editor_state.screen_top1}return {x=Settings.source.x, y=Settings.source.y, displayindex=Settings.source.displayindex,width=App.screen.width, height=App.screen.height,font_height=Editor_state.font_height,if File_navigation.cursors[filename] thenEditor_state.screen_top1 = File_navigation.cursors[filename].screen_top1Editor_state.cursor1 = File_navigation.cursors[filename].cursor1elseEditor_state.screen_top1 = {line=1, pos=1}Editor_state.cursor1 = {line=1, pos=1}endendfunction source.draw()Editor_state.filename = 'run.lua'Editor_state.font_height = font_heightEditor_state.line_height = math.floor(font_height*1.3)Editor_state.em = emendfunction source.initialize_window_geometry(em_width)-- maximize window-- save cursor positionFile_navigation.cursors[Editor_state.filename] = {cursor1=Editor_state.cursor1, screen_top1=Editor_state.screen_top1}-- clear the slate for the new fileEditor_state.filename = filenameload_from_disk(Editor_state)Text.redraw_all(Editor_state)filename=Editor_state.filename,cursors=File_navigation.cursors,show_log_browser_side=Show_log_browser_side,focus=Focus,}endfunction source.mouse_pressed(x,y, mouse_button)Cursor_time = 0 -- ensure cursor is visible immediately after it moves--? print('mouse click', x, y)--? print(Editor_state.left, Editor_state.right)--? print(Log_browser_state.left, Log_browser_state.right)function source.initialize_edit_side()load_from_disk(Editor_state)Text.redraw_all(Editor_state)if settings.cursors thenFile_navigation.cursors = settings.cursorsEditor_state.screen_top1 = File_navigation.cursors[Editor_state.filename].screen_top1Editor_state.cursor1 = File_navigation.cursors[Editor_state.filename].cursor1else-- migrate old settingsEditor_state.screen_top1 = {line=1, pos=1}Editor_state.cursor1 = {line=1, pos=1}endendfunction source.set_window_position_from_settings(settings)-- setPosition doesn't quite seem to do what is asked of it on Linux.love.window.setPosition(settings.x, settings.y-37, settings.displayindex)endfunction source.initialize_default_settings()local font_height = 20love.graphics.setFont(love.graphics.newFont(font_height))local em = App.newText(love.graphics.getFont(), 'm')source.initialize_window_geometry(App.width(em))Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width-Margin_right)if File_navigation.cursors[Editor_state.filename] thenEditor_state.screen_top1 = File_navigation.cursors[Editor_state.filename].screen_top1Editor_state.cursor1 = File_navigation.cursors[Editor_state.filename].cursor1elseEditor_state.screen_top1 = {line=1, pos=1}Editor_state.cursor1 = {line=1, pos=1}endEditor_state.filename = basename(Editor_state.filename) -- migrate settings that used full paths; we now support only relative paths within the appif Show_file_navigator and y < Menu_status_bar_height + File_navigation.num_lines * Editor_state.line_height then-- send click to buttonsedit.mouse_pressed(Editor_state, x,y, mouse_button)returnendif x < Editor_state.right + Margin_right thensource.initialize_edit_side()source.initialize_log_browser_side()Menu_status_bar_height = 5 + Editor_state.line_height + 5Editor_state.top = Editor_state.top + Menu_status_bar_heightLog_browser_state.top = Log_browser_state.top + Menu_status_bar_height
reset_file_navigator()navigate_to_file(File_navigation.candidates[File_navigation.index])elseif chord == 'backspace' thenlocal len = utf8.len(File_navigation.filter)local byte_offset = Text.offset(File_navigation.filter, len)File_navigation.filter = string.sub(File_navigation.filter, 1, byte_offset-1)File_navigation.index = 1File_navigation.candidates = source.file_navigator_candidates()elseif chord == 'return' thenfunction navigate_to_file(s)local candidate = guess_source(s..'.lua')source.switch_to_file(candidate)reset_file_navigator()endfunction reset_file_navigator()Show_file_navigator = falseFile_navigation.index = 1File_navigation.filter = ''File_navigation.candidates = File_navigation.all_candidatesendfunction keychord_pressed_on_file_navigator(chord, key)endfunction move_candidate_to_front(s)local index = array.find(File_navigation.all_candidates, s)assert(index)table.remove(File_navigation.all_candidates, index)table.insert(File_navigation.all_candidates, 1, s)move_candidate_to_front(s)navigate_to_file(s)end})
endfunction dirname(path)local os_path_separator = package.config:sub(1,1)if os_path_separator == '/' then-- POSIX systems permit backslashes in filenamesreturn path:match('.*/') or './'elseif os_path_separator == '\\' thenreturn path:match('.*[/\\]') or './'elseerror('What OS is this? LÖVE reports that the path separator is "'..os_path_separator..'"')endendfunction test_dirname()check_eq(dirname('a/b'), 'a/', 'F - test_dirname')check_eq(dirname('x'), './', 'F - test_dirname/current')endfunction basename(path)local os_path_separator = package.config:sub(1,1)if os_path_separator == '/' then-- POSIX systems permit backslashes in filenamesreturn string.gsub(path, ".*/(.*)", "%1")elseif os_path_separator == '\\' thenreturn string.gsub(path, ".*[/\\](.*)", "%1")elseerror('What OS is this? LÖVE reports that the path separator is "'..os_path_separator..'"')end
function empty(h)for _,_ in pairs(h) doreturn falseendreturn trueend
function source.initialize_edit_side(arg)if #arg > 0 thenEditor_state.filename = arg[1]load_from_disk(Editor_state)Text.redraw_all(Editor_state)
function source.initialize_edit_side()load_from_disk(Editor_state)Text.redraw_all(Editor_state)if File_navigation.cursors[Editor_state.filename] thenEditor_state.screen_top1 = File_navigation.cursors[Editor_state.filename].screen_top1Editor_state.cursor1 = File_navigation.cursors[Editor_state.filename].cursor1else
Editor_state.screen_top1 = settings.screen_topEditor_state.cursor1 = settings.cursor
Editor_state.filename = basename(Editor_state.filename) -- migrate settings that used full paths; we now support only relative paths within the appif settings.cursors thenFile_navigation.cursors = settings.cursorsEditor_state.screen_top1 = File_navigation.cursors[Editor_state.filename].screen_top1Editor_state.cursor1 = File_navigation.cursors[Editor_state.filename].cursor1else-- migrate old settingsEditor_state.screen_top1 = {line=1, pos=1}Editor_state.cursor1 = {line=1, pos=1}end
Editor_state.screen_top1 = {line=1, pos=1}Editor_state.cursor1 = {line=1, pos=1}
if File_navigation.cursors[filename] thenEditor_state.screen_top1 = File_navigation.cursors[filename].screen_top1Editor_state.cursor1 = File_navigation.cursors[filename].cursor1elseEditor_state.screen_top1 = {line=1, pos=1}Editor_state.cursor1 = {line=1, pos=1}end
function navigate_to_file(s)move_candidate_to_front(s)local candidate = guess_source(s..'.lua')source.switch_to_file(candidate)reset_file_navigator()endfunction move_candidate_to_front(s)local index = array.find(File_navigation.all_candidates, s)assert(index)table.remove(File_navigation.all_candidates, index)table.insert(File_navigation.all_candidates, 1, s)endfunction reset_file_navigator()Show_file_navigator = falseFile_navigation.index = 1File_navigation.filter = ''File_navigation.candidates = File_navigation.all_candidatesend
local candidate = guess_source(File_navigation.candidates[File_navigation.index]..'.lua')source.switch_to_file(candidate)Show_file_navigator = falseFile_navigation.index = 1File_navigation.filter = ''File_navigation.candidates = File_navigation.all_candidates
navigate_to_file(File_navigation.candidates[File_navigation.index])