Merge lines.love
[?]
Sep 19, 2022, 7:55 AM
ATQO62TFDZ7J4RCOSB3K2QCCB5R6PNYQIIGNXTLZMEFG5UG5PUJQCDependencies
- [2]
VBU5YHLRMerge lines.love - [3]
MKPXANB5bugfix: mouse clicks on file navigator above log browser side - [4]
L2FWWEQLsource: remember cursor position of multiple files - [5]
W6XUYQKPsource: show files in MRU order - [6]
YMNOUE2Mugh, missed deleting an arg - [7]
A23MMLJHmigrate old settings, attempt #3 - [8]
LXTTOB33extract a couple of files - [9]
5ZA3BRNYadd state arg to a few functions - [10]
JOPVPUSAediting source code from within the app - [11]
D2GCFTTTclean up repl functionality - [12]
VHQCNMARseveral more modules - [13]
OTIBCAUJlove2d scaffold - [14]
KMSL74GAsupport selections in the source editor - [15]
ZJOSQFN6bugfix: path munging on Windows - [16]
CE4LZV4Tdrop last couple of manual tests - [17]
ZTK4QTZTextract a couple of functions - [18]
C3NYQP57Merge lines.love - [19]
2CTN2IEFMerge lines.love - [20]
BLWAYPKVextract a module - [21]
D4B52CQ2Merge lines.love - [22]
QSKWIEU3support special chars like '(' in search - [23]
6LJZN727handle chords - [24]
S3PNFXTBhandle missing cursors in settings - [25]
AKZWDWIAMerge lines.love - [26]
QZ2SXLHFsome debug prints - [27]
GUOQRUL7Merge lines.love - [28]
73OCE2MCafter much struggle, a brute-force undo - [29]
MDGHRTIFsource: up/down in file navigator - [30]
32V6ZHQBMerge lines.love - [31]
KKMFQDR4editing source code from within the app - [32]
XX7G2FFJintermingle freehand line drawings with text - [33]
TVCPXAAUrename - [34]
MUJTM6REbring back a level of wrapping - [35]
LLAOOMULbugfix: search upwards - [36]
7PZ4CQFVsearch: transparently handle drawings everywhere - [37]
3QWK3GSAsupport mouse clicks in file navigator - [38]
B4JEWKWIhide editor cursor while in file navigator - [39]
VXORMHMEdelete experimental REPL - [40]
AOZX2G5Fsource: no commandline args - [41]
P3K7UH5CMerge lines.love - [42]
BULPIBEGbeginnings of a module for the text editor - [43]
RQUVBX62filter candidates in file navigator - [44]
C7OO4H3Ssource: support only relative paths within the app - [45]
OI4FPFINsupport drawings in the source editor - [46]
4YDBYBA4clean up memory leak experiments - [47]
T4FRZSYLdelete an ancient, unused file - [48]
R5QXEHUIsomebody stop me - [49]
BYKXF3YYbugfix: draw menu after everything else - [50]
EETIR4GXbugfix: skip over drawings when searching - [51]
SDO4DHNUsource: load cursor position from settings - [52]
3QNOKBFMbeginnings of a test harness - [53]
RSZD5A7Gforgot to add json.lua - [54]
BJ5X5O4Alet's prevent the text cursor from ever getting on a drawing - [55]
66X36NZNa little more prose describing manual_tests - [56]
VHUNJHXBMerge lines.love - [57]
NFI42KGXmore correct absolute path detection - [58]
JMUD7T3Oget rid of ugly side-effects in tests - [59]
NYRESFK6source: show all files in navigator - [60]
X3CQLBTRset window title within each app - [61]
OGUV4HSAremove some memory leaks from rendered fragments - [62]
3PSFWAILMerge lines.love - [63]
AVTNUQYRbasic test-enabled framework - [64]
FS2ITYYHrecord a known issue - [65]
K2X6G75Zstart writing some tests for drawings - [66]
MSOQI3A5bugfix: check before cursor on same line - [67]
MD3W5IRAnew fork: rip out drawing support - [68]
AYX33NBCMerge lines.love - [69]
D3FLL7SLstart showing source menu file navigation state graphically - [70]
2L5MEZV3experiment: new edit namespace - [71]
TLOAPLBJadd a license - [72]
AMOPICKVbugfix: check after cursor on same line when searching upwards
Change contents
- file deletion: source_file.lua source_file.lua
function empty(h)for _,_ in pairs(h) doreturn falseendreturn trueendendfunction 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..'"')endend - file deletion: source.lua source.lua
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 - file deletion: commands.lua commands.lua
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)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}) - edit in source_file.lua at line 218
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 - edit in source_file.lua at line 248[8.503]
function empty(h)for _,_ in pairs(h) doreturn falseendreturn trueend - edit in source.lua at line 48
cursors = {}, -- filename to cursor1, screen_top1 - replacement in source.lua at line 75
source.initialize_edit_side{'run.lua'}source.initialize_edit_side() - replacement in source.lua at line 86
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 - edit in source.lua at line 95
elseload_from_disk(Editor_state)Text.redraw_all(Editor_state)endif #arg > 1 thenprint('ignoring commandline args after '..arg[1]) - replacement in source.lua at line 137
Editor_state.screen_top1 = settings.screen_topEditor_state.cursor1 = settings.cursorEditor_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 - edit in source.lua at line 160
Editor_state.filename = 'run.lua' - edit in source.lua at line 222
-- save cursor positionFile_navigation.cursors[Editor_state.filename] = {cursor1=Editor_state.cursor1, screen_top1=Editor_state.screen_top1} - replacement in source.lua at line 228
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 - edit in source.lua at line 274
endlocal filename = Editor_state.filenameif is_relative_path(filename) thenfilename = love.filesystem.getWorkingDirectory()..'/'..filename -- '/' should work even on Windows - edit in source.lua at line 276
File_navigation.cursors[Editor_state.filename] = {cursor1=Editor_state.cursor1, screen_top1=Editor_state.screen_top1} - replacement in source.lua at line 281
filename=filename,screen_top=Editor_state.screen_top1, cursor=Editor_state.cursor1,filename=Editor_state.filename,cursors=File_navigation.cursors, - edit in source.lua at line 293
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)returnend - edit in search.lua at line 24
local pos = find(State.lines[State.cursor1.line].data, State.search_term, State.cursor1.pos) - edit in search.lua at line 31
pos = find(State.lines[i].data, State.search_term) - edit in search.lua at line 41
pos = find(State.lines[i].data, State.search_term) - edit in search.lua at line 50
pos = find(State.lines[State.cursor1.line].data, State.search_term) - edit in search.lua at line 70
local pos = rfind(State.lines[State.cursor1.line].data, State.search_term, State.cursor1.pos-1) - edit in search.lua at line 77
pos = rfind(State.lines[i].data, State.search_term) - edit in search.lua at line 87
pos = rfind(State.lines[i].data, State.search_term) - edit in search.lua at line 96
pos = rfind(State.lines[State.cursor1.line].data, State.search_term) - edit in commands.lua at line 67
if filename == 'source' thenApp.color(Menu_border_color)love.graphics.line(Menu_cursor-10,2, Menu_cursor-10,Menu_status_bar_height-2)end - replacement in commands.lua at line 123
local candidate = guess_source(s..'.lua')source.switch_to_file(candidate)Show_file_navigator = falsenavigate_to_file(s) - edit in commands.lua at line 132
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 - replacement in commands.lua at line 157
Show_file_navigator = falseFile_navigation.index = 1File_navigation.filter = ''File_navigation.candidates = File_navigation.all_candidatesreset_file_navigator() - replacement in commands.lua at line 159
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_candidatesnavigate_to_file(File_navigation.candidates[File_navigation.index])