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HVWGGGDEGLJKL4PIQC if 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 thenfilename=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)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()-- 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)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 windowEditor_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}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)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].cursor1elseEditor_state.screen_top1 = {line=1, pos=1}Editor_state.cursor1 = {line=1, pos=1}source.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_heightcursors = {}, -- filename to cursor1, screen_top1}
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()reset_file_navigator()elseif chord == 'return' thenfunction 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_candidatesendfunction keychord_pressed_on_file_navigator(chord, key)navigate_to_file(s)end})
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
endlocal filename = Editor_state.filenameif is_relative_path(filename) thenfilename = love.filesystem.getWorkingDirectory()..'/'..filename -- '/' should work even on Windows
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])