bring back everything from commit a68647ae22

[?]
Nov 6, 2022, 4:53 PM
JCXL74WVQ23V53EOCKA2NXQIYA5NNOXGN5WYC7ZW42EI2I6D5IJAC

Dependencies

  • [2] 36Z442IV back to commit 8123959e52f without code editing
  • [3] CVSRHMJ2 experiment: slightly adaptive scrolling
  • [4] MXA3RZYK deduce left/right from state where possible
  • [5] QCPXQ2E3 add state arg to a few functions
  • [6] YT5P6TO6 bugfix: save previous file when dropping a new one on
  • [7] UPCIYZEU drop an unnecessary level of indent
  • [8] ATQO62TF Merge lines.love
  • [9] KOYAJWE4 extract a couple more methods
  • [10] AMOPICKV bugfix: check after cursor on same line when searching upwards
  • [11] MD3W5IRA new fork: rip out drawing support
  • [12] M6TH7VSZ rip out notion of Line_width
  • [13] VSBSWTE4 bugfix: where cursor is drawn
  • [14] LLAOOMUL bugfix: search upwards
  • [15] 4QQBMWLL regression: typing uppercase letters in text
  • [16] LF7BWEG4 group all editor globals
  • [17] ZPUQSPQP extract a few methods
  • [18] 2RXZ3PGO beginning of a new approach to scroll+wrap
  • [19] KZ5GAYRP this fixes the immediate regression
  • [20] UHB4GARJ left/right margin -> left/right coordinates
  • [21] HGC5RGJP switch to line index in a function
  • [22] 2L5MEZV3 experiment: new edit namespace
  • [23] 3HDWCPDI bugfix: include shift keys in modifier_down
  • [24] QSKWIEU3 support special chars like '(' in search
  • [25] E4HEHLRT extract a variable
  • [26] Z5HLXU4P add state arg to a few functions
  • [27] MUJTM6RE bring back a level of wrapping
  • [28] QYIFOHW3 first test!
  • [29] 5DOTWNVM right margin
  • [30] EETIR4GX bugfix: skip over drawings when searching
  • [31] VHQCNMAR several more modules
  • [32] JOPVPUSA editing source code from within the app
  • [33] LSYLEVBD drop some redundant args when clearing the cache
  • [34] ETM7ENJR some helpers
  • [35] PX3736DX better error message
  • [36] 2CTN2IEF Merge lines.love
  • [37] 7EQLPB3O bugfix: don't delete selection when moving cursor
  • [38] CNCYMM6A make test initializations a little more obvious
  • [39] TGHAJBES use line cache for drawings as well
  • [40] PFT5Y2ZY move
  • [41] CE4LZV4T drop last couple of manual tests
  • [42] EAEGCJV5 rename
  • [43] KKMFQDR4 editing source code from within the app
  • [44] ILOA5BYF separate data structure for each line's cache data
  • [45] RXNR3U5E Merge text.love
  • [46] ZJOSQFN6 bugfix: path munging on Windows
  • [47] LXTTOB33 extract a couple of files
  • [48] HOSPP2AN crisp font rendering
  • [49] 5ZA3BRNY add state arg to a few functions
  • [50] MSOQI3A5 bugfix: check before cursor on same line
  • [51] TGZAJUEF bring back a set of constants
  • [52] OI4FPFIN support drawings in the source editor
  • [53] NDHQN23G done passing left/right margins everywhere
  • [54] V7LATJC7 bugfix: resize
  • [55] 7PZ4CQFV search: transparently handle drawings everywhere
  • [56] SPNMXTYR have file API operate on state object
  • [57] ZLJGZYQG select text with shift + mouseclick
  • [58] 3PSFWAIL Merge lines.love
  • [59] LNUHQOGH start passing in Editor_state explicitly
  • [60] 2WGHUWE6 self-documenting 0 Test_right_margin
  • [*] BULPIBEG beginnings of a module for the text editor
  • [*] GNQC72UX generalize a function
  • [*] KV7GGVER couple of accidental globals
  • [*] KOTI3MFG bugfix in previous commit
  • [*] OTIBCAUJ love2d scaffold
  • [*] 6LJZN727 handle chords
  • [*] 3QNOKBFM beginnings of a test harness
  • [*] AVTNUQYR basic test-enabled framework
  • [*] JMUD7T3O get rid of ugly side-effects in tests
  • [*] 4KC7I3E2 make colors easier to edit
  • [*] BJ5X5O4A let's prevent the text cursor from ever getting on a drawing

Change contents

  • replacement in text.lua at line 121
    [3.2940][2.75:152]()
    --? print('x: '..tostring(x)..'; '..tostring(State.right-x)..'px to go')
    [3.2940]
    [3.3]
    --? print('x: '..tostring(x)..'; frag_width: '..tostring(frag_width)..'; '..tostring(State.right-x)..'px to go')
  • replacement in text.lua at line 364
    [3.242][2.153:221]()
    State.cursor1.line = State.cursor1.line+1
    State.cursor1.pos = 1
    [3.242]
    [3.46]
    State.cursor1 = {line=State.cursor1.line+1, pos=1}
  • replacement in text.lua at line 380
    [3.858][2.222:312]()
    State.cursor1.line = State.screen_top1.line
    State.cursor1.pos = State.screen_top1.pos
    [3.858]
    [3.537]
    State.cursor1 = {line=State.screen_top1.line, pos=State.screen_top1.pos}
  • replacement in text.lua at line 399
    [3.3234][2.313:421]()
    State.screen_top1.line = State.screen_bottom1.line
    State.screen_top1.pos = State.screen_bottom1.pos
    [3.3234]
    [3.3318]
    State.screen_top1 = {line=State.screen_bottom1.line, pos=State.screen_bottom1.pos}
  • replacement in text.lua at line 402
    [3.3692][2.422:512]()
    State.cursor1.line = State.screen_top1.line
    State.cursor1.pos = State.screen_top1.pos
    [3.3692]
    [3.707]
    State.cursor1 = {line=State.screen_top1.line, pos=State.screen_top1.pos}
  • edit in text.lua at line 467
    [63.224]
    [64.128]
    Text.populate_screen_line_starting_pos(State, State.cursor1.line)
  • edit in text.lua at line 613
    [3.2786]
    [3.2786]
    --? print('to2:', State.cursor1.line, State.cursor1.pos)
  • edit in text.lua at line 615
    [3.2832]
    [65.533]
    --? print('to2: =>', top2.line, top2.screen_line, top2.screen_pos)
    -- slide to start of screen line
  • edit in text.lua at line 618
    [65.580]
    [3.3087]
    --? print('snap', State.screen_top1.line, State.screen_top1.pos, State.screen_top1.posB, State.cursor1.line, State.cursor1.pos, State.screen_bottom1.line, State.screen_bottom1.pos)
  • edit in text.lua at line 635
    [3.3781]
    [3.3781]
    --? print('snap =>', State.screen_top1.line, State.screen_top1.pos, State.cursor1.line, State.cursor1.pos, State.screen_bottom1.line, State.screen_bottom1.pos)
  • replacement in text.lua at line 792
    [3.34][2.513:562]()
    local result = {line=loc1.line, screen_line=1}
    [3.34]
    [3.3]
    local result = {line=loc1.line}
  • replacement in search.lua at line 24
    [3.758][2.607:702]()
    local pos = find(State.lines[State.cursor1.line].data, State.search_term, State.cursor1.pos)
    [3.758]
    [3.101]
    local pos = find(State.lines[State.cursor1.line].data, State.search_term, State.cursor1.pos, --[[literal]] true)
  • replacement in search.lua at line 31
    [3.211][2.703:760]()
    pos = find(State.lines[i].data, State.search_term)
    [3.211]
    [3.201]
    pos = find(State.lines[i].data, State.search_term, --[[from start]] nil, --[[literal]] true)
  • replacement in search.lua at line 33
    [3.219][2.761:824]()
    State.cursor1.line = i
    State.cursor1.pos = pos
    [3.219]
    [3.282]
    State.cursor1 = {line=i, pos=pos}
  • replacement in search.lua at line 41
    [3.368][2.825:882]()
    pos = find(State.lines[i].data, State.search_term)
    [3.368]
    [3.50189]
    pos = find(State.lines[i].data, State.search_term, --[[from start]] nil, --[[literal]] true)
  • replacement in search.lua at line 43
    [3.50207][2.883:946]()
    State.cursor1.line = i
    State.cursor1.pos = pos
    [3.50207]
    [3.50258]
    State.cursor1 = {line=i, pos=pos}
  • replacement in search.lua at line 50
    [3.833][2.947:1019]()
    pos = find(State.lines[State.cursor1.line].data, State.search_term)
    [3.833]
    [3.427]
    pos = find(State.lines[State.cursor1.line].data, State.search_term, --[[from start]] nil, --[[literal]] true)
  • replacement in search.lua at line 70
    [3.800][2.1020:1118]()
    local pos = rfind(State.lines[State.cursor1.line].data, State.search_term, State.cursor1.pos-1)
    [3.800]
    [3.50856]
    local pos = rfind(State.lines[State.cursor1.line].data, State.search_term, State.cursor1.pos-1, --[[literal]] true)
  • replacement in search.lua at line 77
    [3.1238][2.1119:1177]()
    pos = rfind(State.lines[i].data, State.search_term)
    [3.1238]
    [3.50998]
    pos = rfind(State.lines[i].data, State.search_term, --[[from end]] nil, --[[literal]] true)
  • replacement in search.lua at line 79
    [3.51016][2.1178:1241]()
    State.cursor1.line = i
    State.cursor1.pos = pos
    [3.51016]
    [3.51067]
    State.cursor1 = {line=i, pos=pos}
  • replacement in search.lua at line 87
    [3.1411][2.1242:1300]()
    pos = rfind(State.lines[i].data, State.search_term)
    [3.1411]
    [3.51229]
    pos = rfind(State.lines[i].data, State.search_term, --[[from end]] nil, --[[literal]] true)
  • replacement in search.lua at line 89
    [3.51247][2.1301:1364]()
    State.cursor1.line = i
    State.cursor1.pos = pos
    [3.51247]
    [3.51298]
    State.cursor1 = {line=i, pos=pos}
  • replacement in search.lua at line 96
    [3.910][2.1365:1438]()
    pos = rfind(State.lines[State.cursor1.line].data, State.search_term)
    [3.910]
    [3.983]
    pos = rfind(State.lines[State.cursor1.line].data, State.search_term, --[[from end]] nil, --[[literal]] true)
  • replacement in search.lua at line 114
    [3.507][2.1439:1464]()
    function find(s, pat, i)
    [3.507]
    [3.532]
    function find(s, pat, i, plain)
  • replacement in search.lua at line 116
    [3.562][2.1465:1489]()
    return s:find(pat, i)
    [3.562]
    [3.51762]
    return s:find(pat, i, plain)
  • replacement in search.lua at line 119
    [3.51767][2.1490:1516]()
    function rfind(s, pat, i)
    [3.51767]
    [3.587]
    function rfind(s, pat, i, plain)
  • replacement in search.lua at line 125
    [3.51901][2.1517:1553]()
    local rendpos = rs:find(rpat, ri)
    [3.51901]
    [3.51937]
    local rendpos = rs:find(rpat, ri, plain)
  • edit in main_tests.lua at line 9
    [3.4513]
    [3.309]
    check_eq(Editor_state.right, 300 - Test_margin_right, 'F - test_resize_window/baseline/left_margin')
  • edit in main_tests.lua at line 11
    [3.332]
    [3.332]
    -- ugly; resize switches to real, non-test margins
  • replacement in main_tests.lua at line 14
    [3.466][2.1594:1733]()
    check_eq(Editor_state.left, Test_margin_left, 'F - test_resize_window/left_margin')
    -- ugly; right margin switches from 0 after resize
    [3.466]
    [3.401]
    check_eq(Editor_state.left, Margin_left, 'F - test_resize_window/left_margin')
  • replacement in main_tests.lua at line 16
    [3.489][2.1734:1840]()
    check_eq(Editor_state.width, 200-Test_margin_left-Margin_right, 'F - test_resize_window/drawing_width')
    [3.489]
    [3.466]
    check_eq(Editor_state.width, 200-Margin_left-Margin_right, 'F - test_resize_window/drawing_width')
  • edit in main.lua at line 73
    [2.3422][2.3422:3495]()
    love.window.setPosition(settings.x, settings.y, settings.displayindex)
  • edit in main.lua at line 78
    [2.3805]
    [2.3805]
    love.window.setPosition(settings.x, settings.y, settings.displayindex)
  • replacement in main.lua at line 154
    [2.6317][2.6317:6352]()
    if filename:sub(1,1) ~= '/' then
    [2.6317]
    [2.6352]
    if is_relative_path(filename) then
  • replacement in keychord.lua at line 59
    [3.228][2.7811:7876]()
    for i,x in ipairs(arr) do
    if x == elem then
    return i
    [3.228]
    [3.203813]
    if type(elem) == 'function' then
    for i,x in ipairs(arr) do
    if elem(x) then
    return i
    end
  • edit in keychord.lua at line 65
    [3.203821]
    [3.73]
    else
    for i,x in ipairs(arr) do
    if x == elem then
    return i
    end
    end
  • replacement in file.lua at line 40
    [3.419][2.7879:7914]()
    outfile:write(line.data, '\n')
    [3.419]
    [3.16214]
    outfile:write(line.data)
    outfile:write('\n')
  • edit in file.lua at line 61
    [3.18211]
    function is_absolute_path(path)
    local os_path_separator = package.config:sub(1,1)
    if os_path_separator == '/' then
    -- POSIX systems permit backslashes in filenames
    return path:sub(1,1) == '/'
    elseif os_path_separator == '\\' then
    if path:sub(2,2) == ':' then return true end -- DOS drive letter followed by volume separator
    local f = path:sub(1,1)
    return f == '/' or f == '\\'
    else
    error('What OS is this? LÖVE reports that the path separator is "'..os_path_separator..'"')
    end
    end
    function is_relative_path(path)
    return not is_absolute_path(path)
    end
  • replacement in edit.lua at line 67
    [3.3539][2.7971:8036]()
    filename = love.filesystem.getUserDirectory()..'/lines.txt',
    [3.3539]
    [3.97660]
    filename = love.filesystem.getUserDirectory()..'/lines.txt', -- '/' should work even on Windows
  • replacement in edit.lua at line 97
    [3.3095][2.8037:8080]()
    State.screen_bottom1.line = line_index
    [3.3095]
    [3.9505]
    State.screen_bottom1 = {line=line_index, pos=nil}
  • replacement in edit.lua at line 234
    [3.7565][2.8212:8365]()
    State.search_backup = {cursor={line=State.cursor1.line, pos=State.cursor1.pos}, screen_top={line=State.screen_top1.line, pos=State.screen_top1.pos}}
    [3.7565]
    [3.7718]
    State.search_backup = {
    cursor={line=State.cursor1.line, pos=State.cursor1.pos},
    screen_top={line=State.screen_top1.line, pos=State.screen_top1.pos},
    }
  • edit in edit.lua at line 330
    [3.5400]
    [3.5400]
    -- Insulate tests from some key globals so I don't have to change the vast
    -- majority of tests when they're modified for the real app.
  • edit in edit.lua at line 333
    [3.5422]
    [3.5422]
    Test_margin_right = 0
  • replacement in edit.lua at line 340
    [3.5600][2.8366:8411]()
    App.screen.width, -- right margin = 0
    [3.5600]
    [3.5645]
    App.screen.width - Test_margin_right,
  • edit in app.lua at line 14
    [68.54]
    [3.84]
    App.snapshot_love()
  • edit in app.lua at line 127
    [3.209590]
    [3.86]
    -- save/restore various framework globals we care about -- only on very first load
    function App.snapshot_love()
    if Love_snapshot then return end
    Love_snapshot = {}
    -- save the entire initial font; it doesn't seem reliably recreated using newFont
    Love_snapshot.initial_font = love.graphics.getFont()
    end
    function App.undo_initialize()
    love.graphics.setFont(Love_snapshot.initial_font)
    end
  • edit in app.lua at line 151
    [69.6072]
    [70.1088]
    end
    -- operations on the LÖVE window within the monitor/display
    function App.screen.resize(width, height, flags)
    App.screen.width = width
    App.screen.height = height
    App.screen.flags = flags
    end
    function App.screen.size()
    return App.screen.width, App.screen.height, App.screen.flags
  • edit in app.lua at line 164
    [70.1093]
    [69.6077]
    function App.screen.move(x,y, displayindex)
    App.screen.x = x
    App.screen.y = y
    App.screen.displayindex = displayindex
    end
    function App.screen.position()
    return App.screen.x, App.screen.y, App.screen.displayindex
    end
  • edit in app.lua at line 191
    [71.1374]
    [69.6421]
    end
    function colortable(app_color)
    return {app_color.r, app_color.g, app_color.b, app_color.a}
  • edit in app.lua at line 403
    [69.7988]
    [69.7988]
    App.screen.resize = love.window.setMode
    App.screen.size = love.window.getMode
    App.screen.move = love.window.setPosition
    App.screen.position = love.window.getPosition
  • edit in Manual_tests.md at line 6
    [3.210131]
    [2.8731]
    Startup:
    - terminal log shows unit tests running