Merge lines.love

[?]
Jul 11, 2023, 12:55 AM
RU4HIK436ZRQJEPZXFS4FQTYVRL7BK5NWKYFGHFHZQOEOBF7M5SQC

Dependencies

  • [2] 3XNFQDDN Merge lines.love
  • [3] EVMVBLXD bugfix: preserve window position
  • [4] UZQ2LGHQ bugfix: preserve window position
  • [5] W5WCQNMP bugfix: Windows pushing title bar off screen
  • [6] G75ITNUV standardize between run and source some more
  • [7] SGMA5JLE save the list of tests in repo
  • [8] ONHKBLLC Merge lines.love
  • [9] K74U4BAU Merge lines.love
  • [10] 73OCE2MC after much struggle, a brute-force undo
  • [11] VHUNJHXB Merge lines.love
  • [12] AYX33NBC Merge lines.love
  • [13] KMSL74GA support selections in the source editor
  • [14] 4J4TX7IS get typed in keystrokes to show on screen on iPad
  • [15] 2L5MEZV3 experiment: new edit namespace
  • [16] S3PNFXTB handle missing cursors in settings
  • [17] NMRUNROT Merge lines.love
  • [18] XX7G2FFJ intermingle freehand line drawings with text
  • [19] CQYKYJJU remember window positions across restart/ctrl+e
  • [20] 6LJZN727 handle chords
  • [21] AVTNUQYR basic test-enabled framework
  • [22] JOPVPUSA editing source code from within the app
  • [23] QJISOCHJ some temporary logging to catch a bug
  • [24] 43WA37TU delete flags that have never been exercised
  • [25] BJ5X5O4A let's prevent the text cursor from ever getting on a drawing
  • [26] UI3IP45F Merge lines.love
  • [27] SBR7ARVH simplify saving settings
  • [28] K2X6G75Z start writing some tests for drawings
  • [29] D76MS2G2 Merge lines.love
  • [30] VHQCNMAR several more modules
  • [31] 4U4VQWNY Merge lines.love
  • [32] P3K7UH5C Merge lines.love
  • [33] VXORMHME delete experimental REPL
  • [34] 2CTN2IEF Merge lines.love
  • [35] VP5KC4XZ Merge lines.love
  • [36] 5RDWSYK2 consistently use App names for methods everywhere
  • [37] ZLJYLPOT Merge lines.love
  • [38] N2NUGNN4 include a brief reference enabling many useful apps
  • [39] 3PSFWAIL Merge lines.love
  • [40] FS2ITYYH record a known issue
  • [41] TLOAPLBJ add a license
  • [42] 4YDBYBA4 clean up memory leak experiments
  • [43] KKMFQDR4 editing source code from within the app
  • [44] ZJOSQFN6 bugfix: path munging on Windows
  • [45] L2FWWEQL source: remember cursor position of multiple files
  • [46] LXTTOB33 extract a couple of files
  • [47] ORKN6EOB Merge lines.love
  • [48] ORRSP7FV deduce test names on failures
  • [49] OTIBCAUJ love2d scaffold
  • [50] A4BSGS2C Merge lines.love
  • [51] ISOFHXB2 App.width can no longer take a Text
  • [52] QS3YLNKZ Merge lines.love
  • [53] 5SM6DRHK port inscript's bugfix to source editor
  • [54] TVCPXAAU rename
  • [55] JDZVBFEI Merge lines.love
  • [56] OMLASW7K experiment at avoiding some merge conflicts
  • [57] NFI42KGX more correct absolute path detection
  • [58] OB5XOXVC deemphasize the source editor
  • [59] D2GCFTTT clean up repl functionality
  • [60] 4VQGE7RA new test
  • [61] A23MMLJH migrate old settings, attempt #3
  • [62] SDO4DHNU source: load cursor position from settings
  • [63] 4SR3Z4Y3 document the version of LÖVE I've been using
  • [64] 3QNOKBFM beginnings of a test harness
  • [65] OGUV4HSA remove some memory leaks from rendered fragments
  • [66] MD3W5IRA new fork: rip out drawing support
  • [67] JKENJ2UG Merge lines.love
  • [68] DB7HJBHJ Merge lines.love
  • [69] JZR3QMTN Merge lines.love
  • [70] RSZD5A7G forgot to add json.lua
  • [71] ATQO62TF Merge lines.love
  • [72] BLWAYPKV extract a module
  • [73] 66X36NZN a little more prose describing manual_tests
  • [74] DCO5BQWV Merge lines.love
  • [75] BULPIBEG beginnings of a module for the text editor
  • [76] EMG7SDLW bugfix: cold start
  • [77] T4FRZSYL delete an ancient, unused file
  • [78] C3NYQP57 Merge lines.love
  • [79] UUTUPEOJ extract a function
  • [80] R5QXEHUI somebody stop me
  • [81] LWPFEZBI Merge lines.love
  • [82] CE4LZV4T drop last couple of manual tests
  • [83] ENENSZLK bugfix: source margins when toggling log browser
  • [84] 2344TV56 Merge lines.love
  • [85] HCFDBUXH fix stale comment

Change contents

  • file deletion: source_tests.lua (----------)source_tests.lua (----------)
    [7.2][7.150199:150239](),[7.2][7.150199:150239](),[7.150239][7.147103:147103]()
    function test_show_log_browser_side_splits_window_width()
    -- initialize screen dimensions and indicate that it is maximized
    App.screen.init{width=300, height=300}
  • file deletion: source.lua (----------)source.lua (----------)
    [7.2][7.177652:177686](),[7.2][7.177652:177686](),[7.177686][7.165766:165766]()
    -- set up desired window dimensions and make window resizable
    _, _, App.screen.flags = App.screen.size()
    App.screen.flags.resizable = true
    App.screen.width, App.screen.height = settings.width, settings.height
    App.screen.resize(App.screen.width, App.screen.height, App.screen.flags)
    Editor_state.right = App.screen.width - Margin_right
    Editor_state.width = Editor_state.right-Editor_state.left
    Text.redraw_all(Editor_state)
    end
    Editor_state.width = Editor_state.right-Editor_state.left
    Text.redraw_all(Editor_state)
    Log_browser_state.left = App.screen.width/2 + Margin_left
    Log_browser_state.right = App.screen.width - Margin_right
    -- Initialize window width/height and make window resizable.
    --
    -- I get tempted to have opinions about window dimensions here, but they're
    -- non-portable:
    -- - maximizing doesn't work on mobile and messes things up
    -- - maximizing keeps the title bar on screen in Linux, but off screen on
    -- Windows. And there's no way to get the height of the title bar.
    -- It seems more robust to just follow LÖVE's default window size until
    -- someone overrides it.
    App.screen.width, App.screen.height, App.screen.flags = App.screen.size()
    Settings.source.x, Settings.source.y, Settings.source.displayindex = App.screen.position()
    File_navigation.cursors[Editor_state.filename] = {cursor1=Editor_state.cursor1, screen_top1=Editor_state.screen_top1}
    if Settings == nil then Settings = {} end
    if Settings.source == nil then Settings.source = {} end
    App.screen.flags.resizable = true
    source.set_window_position_from_settings(settings)
    Show_log_browser_side = settings.show_log_browser_side
    local right = App.screen.width - Margin_right
    if Show_log_browser_side then
    right = App.screen.width/2 - Margin_right
    end
    Editor_state = edit.initialize_state(Margin_top, Margin_left, right, settings.font_height, math.floor(settings.font_height*1.3))
    Editor_state.filename = settings.filename
    local os = love.system.getOS()
    if os == 'Linux' then
    -- love.window.setPosition doesn't quite seem to do what is asked of it on Linux.
    App.screen.move(settings.x, settings.y-37, settings.displayindex)
    else
    App.screen.move(settings.x, settings.y, settings.displayindex)
    end
    end
    function source.initialize_default_settings()
    local font_height = 20
    love.graphics.setFont(love.graphics.newFont(font_height))
  • file deletion: run.lua (----------)run.lua (----------)
    [7.2][7.184046:184077](),[7.2][7.184046:184077](),[7.184077][7.178044:178044]()
    -- set up desired window dimensions and make window resizable
    _, _, App.screen.flags = App.screen.size()
    -- Initialize window width/height and make window resizable.
    --
    -- I get tempted to have opinions about window dimensions here, but they're
    -- non-portable:
    -- - maximizing doesn't work on mobile and messes things up
    -- - maximizing keeps the title bar on screen in Linux, but off screen on
    -- Windows. And there's no way to get the height of the title bar.
    -- It seems more robust to just follow LÖVE's default window size until
    -- someone overrides it.
    if Settings == nil then Settings = {} end
    Settings.x, Settings.y, Settings.displayindex = App.screen.position()
    return {
    App.screen.width, App.screen.height, App.screen.flags = App.screen.size()
    App.screen.flags.resizable = true
    end
    function run.set_window_position_from_settings(settings)
    local os = love.system.getOS()
    if os == 'Linux' then
    -- love.window.setPosition doesn't quite seem to do what is asked of it on Linux.
    App.screen.move(settings.x, settings.y-37, settings.displayindex)
    else
    App.screen.move(settings.x, settings.y, settings.displayindex)
    end
    end
    function run.initialize_default_settings()
    local font_height = 20
    love.graphics.setFont(love.graphics.newFont(font_height))
    run.set_window_position_from_settings(Settings)
    Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width-Margin_right, Settings.font_height, math.floor(Settings.font_height*1.3))
    Editor_state.filename = Settings.filename
    Editor_state.screen_top1 = Settings.screen_top
    Editor_state.cursor1 = Settings.cursor
  • edit in source_tests.lua at line 22
    [7.240][7.240:275]()
    Display_width = App.screen.width
  • replacement in source_tests.lua at line 36
    [7.787][7.787:858](),[7.934][7.934:1688](),[7.1688][7.45:81](),[7.81][7.1714:1775](),[7.1714][7.1714:1775](),[7.1775][7.23423:23474](),[7.23474][7.1890:1927](),[7.1890][7.1890:1927](),[7.1927][7.23475:23594](),[7.23594][7.2174:2212](),[7.2174][7.2174:2212](),[7.2212][7.23595:23758](),[7.23758][7.2503:2595](),[7.2503][7.2503:2595]()
    function test_show_log_browser_side_doubles_window_width_if_possible()
    -- initialize screen dimensions to half width
    App.screen.init{width=300, height=300}
    Display_width = App.screen.width*2
    -- initialize source app with left side occupying entire window (half the display)
    Current_app = 'source'
    Editor_state = edit.initialize_test_state()
    Editor_state.filename = 'foo'
    Editor_state.left = Margin_left
    Editor_state.right = App.screen.width - Margin_right
    local old_editor_right = Editor_state.right
    Text.redraw_all(Editor_state)
    Log_browser_state = edit.initialize_test_state()
    -- log browser has some arbitrary margins
    Log_browser_state.left = 200 + Margin_left
    Log_browser_state.right = 400
    Text.redraw_all(Log_browser_state)
    log_browser.parse(Log_browser_state)
    -- display log browser
    Current_time = Current_time + 0.1
    App.run_after_keychord('C-l')
    -- window width is doubled
    check_eq(App.screen.width, 600, 'display:width')
    -- left side margins are unchanged
    check_eq(Editor_state.left, Margin_left, 'edit:left')
    check_eq(Editor_state.right, old_editor_right, 'edit:right')
    -- log browser margins are adjusted
    check_eq(Log_browser_state.left, App.screen.width/2 + Margin_left, 'log:left')
    check_eq(Log_browser_state.right, App.screen.width - Margin_right, 'log:right')
    end
    function test_show_log_browser_side_resizes_both_sides_if_cannot_double_window_width()
    [7.787]
    [7.2687]
    function test_show_log_browser_side_splits_window_width()
  • edit in source_tests.lua at line 39
    [7.2796][7.2796:2818]()
    Display_width = 300
  • replacement in source.lua at line 124
    [7.168600][7.12:59](),[7.59][7.169203:169289](),[7.4504][7.169203:169289](),[7.169203][7.169203:169289]()
    source.resize_window_from_settings(settings)
    --? print('loading source position', settings.x, settings.y, settings.displayindex)
    [7.168600]
    [7.169289]
    -- set up desired window dimensions and make window resizable
    _, _, App.screen.flags = App.screen.size()
    App.screen.flags.resizable = true
    App.screen.width, App.screen.height = settings.width, settings.height
    App.screen.resize(App.screen.width, App.screen.height, App.screen.flags)
  • replacement in source.lua at line 149
    [7.71][7.71:125]()
    function source.resize_window_from_settings(settings)
    [7.71]
    [7.125]
    function source.set_window_position_from_settings(settings)
  • replacement in source.lua at line 151
    [7.158][7.158:443]()
    if os == 'Android' or os == 'iOS' then
    -- maximizing on iOS breaks text rendering: https://github.com/deltadaedalus/vudu/issues/7
    -- no point second-guessing window dimensions on mobile
    App.screen.width, App.screen.height, App.screen.flags = App.screen.size()
    return
    [7.158]
    [7.2001]
    if os == 'Linux' then
    -- love.window.setPosition doesn't quite seem to do what is asked of it on Linux.
    App.screen.move(settings.x, settings.y-37, settings.displayindex)
    else
    App.screen.move(settings.x, settings.y, settings.displayindex)
  • edit in source.lua at line 157
    [7.2007][7.444:1039]()
    -- maximize window to determine maximum allowable dimensions
    App.screen.resize(0, 0) -- maximize
    Display_width, Display_height, App.screen.flags = App.screen.size()
    -- set up desired window dimensions
    App.screen.flags.resizable = true
    App.screen.flags.minwidth = math.min(Display_width, 200)
    App.screen.flags.minheight = math.min(Display_height, 200)
    App.screen.width, App.screen.height = settings.width, settings.height
    --? print('setting window from settings:', App.screen.width, App.screen.height)
    App.screen.resize(App.screen.width, App.screen.height, App.screen.flags)
  • edit in source.lua at line 159
    [7.169801][7.169801:169861](),[7.169861][7.1040:1192](),[7.1192][7.170009:170014](),[7.170009][7.170009:170014]()
    function source.set_window_position_from_settings(settings)
    -- love.window.setPosition doesn't quite seem to do what is asked of it on Linux.
    App.screen.move(settings.x, settings.y-37, settings.displayindex)
    end
  • replacement in source.lua at line 170
    [7.170525][7.1193:1517](),[7.1517][7.170525:170546](),[7.170525][7.170525:170546](),[7.170546][7.4505:4614](),[7.4614][7.170661:170796](),[7.170661][7.170661:170796]()
    local os = love.system.getOS()
    if os == 'Android' or os == 'iOS' then
    -- maximizing on iOS breaks text rendering: https://github.com/deltadaedalus/vudu/issues/7
    -- no point second-guessing window dimensions on mobile
    App.screen.width, App.screen.height, App.screen.flags = App.screen.size()
    return
    end
    -- maximize window
    App.screen.resize(0, 0) -- maximize
    Display_width, Display_height, App.screen.flags = App.screen.size()
    -- shrink height slightly to account for window decoration
    App.screen.height = Display_height-100
    App.screen.width = 40*em_width
    [7.170525]
    [7.170796]
    -- Initialize window width/height and make window resizable.
    --
    -- I get tempted to have opinions about window dimensions here, but they're
    -- non-portable:
    -- - maximizing doesn't work on mobile and messes things up
    -- - maximizing keeps the title bar on screen in Linux, but off screen on
    -- Windows. And there's no way to get the height of the title bar.
    -- It seems more robust to just follow LÖVE's default window size until
    -- someone overrides it.
    App.screen.width, App.screen.height, App.screen.flags = App.screen.size()
  • edit in source.lua at line 181
    [7.170832][7.170832:170894](),[7.170894][7.12:76]()
    App.screen.flags.minwidth = math.min(App.screen.width, 200)
    App.screen.flags.minheight = math.min(App.screen.height, 200)
  • edit in source.lua at line 182
    [7.4690][7.171034:171176](),[7.171034][7.171034:171176](),[7.171176][7.4691:4784]()
    print('initializing source position')
    if Settings == nil then Settings = {} end
    if Settings.source == nil then Settings.source = {} end
    Settings.source.x, Settings.source.y, Settings.source.displayindex = App.screen.position()
  • replacement in source.lua at line 272
    [7.173790][7.173790:173872](),[7.173872][7.4785:4880](),[7.297][7.174157:174269](),[7.647][7.174157:174269](),[7.174157][7.174157:174269]()
    if Current_app == 'source' then
    --? print('reading source window position')
    Settings.source.x, Settings.source.y, Settings.source.displayindex = App.screen.position()
    end
    --? print('saving source settings', Settings.source.x, Settings.source.y, Settings.source.displayindex)
    [7.173790]
    [7.2486]
    if Settings == nil then Settings = {} end
    if Settings.source == nil then Settings.source = {} end
    Settings.source.x, Settings.source.y, Settings.source.displayindex = App.screen.position()
  • edit in source.lua at line 357
    [7.176452][7.4881:4950]()
    App.screen.width = math.min(Display_width, App.screen.width*2)
  • edit in source.lua at line 358
    [7.5011]
    [7.5011]
    Editor_state.width = Editor_state.right-Editor_state.left
    Text.redraw_all(Editor_state)
  • replacement in source.lua at line 363
    [7.176525][7.176525:176662](),[7.176662][7.5140:5217](),[7.5217][7.176741:176893](),[7.176741][7.176741:176893](),[7.176893][7.12:106]()
    App.screen.width = Editor_state.right + Margin_right
    end
    --? print('setting window:', App.screen.width, App.screen.height)
    App.screen.resize(App.screen.width, App.screen.height, App.screen.flags)
    --? print('done setting window')
    -- try to restore position if possible
    -- if the window gets wider the window manager may not respect this
    if not App.run_tests then
    source.set_window_position_from_settings(Settings.source)
    [7.176525]
    [7.106]
    Editor_state.right = App.screen.width - Margin_right
    Editor_state.width = Editor_state.right-Editor_state.left
    Text.redraw_all(Editor_state)
  • replacement in run.lua at line 58
    [7.179300][7.16:60](),[7.60][7.1522:1598](),[7.1598][7.179443:179481](),[7.179443][7.179443:179481]()
    -- determine default dimensions and flags
    App.screen.width, App.screen.height, App.screen.flags = App.screen.size()
    -- set up desired window dimensions
    [7.179300]
    [7.179554]
    -- set up desired window dimensions and make window resizable
    _, _, App.screen.flags = App.screen.size()
  • edit in run.lua at line 61
    [7.179590][7.179590:179652](),[7.179652][7.81:145]()
    App.screen.flags.minwidth = math.min(App.screen.width, 200)
    App.screen.flags.minheight = math.min(App.screen.height, 200)
  • replacement in run.lua at line 63
    [7.1674][7.1674:1739]()
    App.screen.move(Settings.x, Settings.y, Settings.displayindex)
    [7.1674]
    [7.179864]
    run.set_window_position_from_settings(Settings)
  • edit in run.lua at line 70
    [7.180158]
    [7.180158]
    function run.set_window_position_from_settings(settings)
    local os = love.system.getOS()
    if os == 'Linux' then
    -- love.window.setPosition doesn't quite seem to do what is asked of it on Linux.
    App.screen.move(settings.x, settings.y-37, settings.displayindex)
    else
    App.screen.move(settings.x, settings.y, settings.displayindex)
    end
    end
  • replacement in run.lua at line 91
    [7.180688][7.1740:2064](),[7.2064][7.180688:180709](),[7.180688][7.180688:180709](),[7.180709][7.2065:2104]()
    local os = love.system.getOS()
    if os == 'Android' or os == 'iOS' then
    -- maximizing on iOS breaks text rendering: https://github.com/deltadaedalus/vudu/issues/7
    -- no point second-guessing window dimensions on mobile
    App.screen.width, App.screen.height, App.screen.flags = App.screen.size()
    return
    end
    -- maximize window
    App.screen.resize(0, 0) -- maximize
    [7.180688]
    [7.2104]
    -- Initialize window width/height and make window resizable.
    --
    -- I get tempted to have opinions about window dimensions here, but they're
    -- non-portable:
    -- - maximizing doesn't work on mobile and messes things up
    -- - maximizing keeps the title bar on screen in Linux, but off screen on
    -- Windows. And there's no way to get the height of the title bar.
    -- It seems more robust to just follow LÖVE's default window size until
    -- someone overrides it.
  • edit in run.lua at line 101
    [7.2180][7.180830:180968](),[7.180830][7.180830:180968]()
    -- shrink height slightly to account for window decoration
    App.screen.height = App.screen.height-100
    App.screen.width = 40*em_width
  • edit in run.lua at line 102
    [7.181004][7.181004:181066](),[7.181066][7.146:210]()
    App.screen.flags.minwidth = math.min(App.screen.width, 200)
    App.screen.flags.minheight = math.min(App.screen.height, 200)
  • replacement in run.lua at line 153
    [7.182338][7.15:65](),[7.65][7.89:120](),[7.182338][7.89:120](),[7.120][7.2257:2331](),[7.485][7.182571:182577](),[7.793][7.182571:182577](),[7.182571][7.182571:182577]()
    if Settings == nil then
    Settings = {}
    end
    if Current_app == 'run' then
    Settings.x, Settings.y, Settings.displayindex = App.screen.position()
    end
    [7.182338]
    [7.182577]
    if Settings == nil then Settings = {} end
    Settings.x, Settings.y, Settings.displayindex = App.screen.position()