get rid of to_text

[?]
Apr 1, 2023, 9:48 PM
R3KXFRZNL4CAT5OSKIIGWR3CHL2YJ5S4TKQDIPEHIJ2HW2WS46BQC

Dependencies

  • [2] HKV72RZV bugfix: save modified files in save directory
  • [3] UN7GKYV5 support hyperlinks in the source editor
  • [4] D3FLL7SL start showing source menu file navigation state graphically
  • [5] FFAPDHHH show partial items in the menu
  • [6] 2CK5QI7W make love event names consistent
  • [7] QFTLLRGL indent
  • [8] ZQZX364V use a helper
  • [9] 3QWK3GSA support mouse clicks in file navigator
  • [10] VHQCNMAR several more modules
  • [11] AVTNUQYR basic test-enabled framework
  • [12] 7CLGG7J2 test: autosave after any shape
  • [13] RQUVBX62 filter candidates in file navigator
  • [14] KYNGDE2C consistent names in a few more places
  • [15] 2Y7YH7UP infrastructure for caching LÖVE text objects
  • [16] XW7ANEJX switch shortcuts for bifold text
  • [17] NYRESFK6 source: show all files in navigator
  • [18] ME7WBLF5 bugfix: log filenames can have 2 formats
  • [19] JMUD7T3O get rid of ugly side-effects in tests
  • [20] OI4FPFIN support drawings in the source editor
  • [21] IOCATA27 bugfix: never skip files in file navigator
  • [22] MDGHRTIF source: up/down in file navigator
  • [23] KKMFQDR4 editing source code from within the app
  • [24] PX7DDEMO autosave slightly less aggressively
  • [25] AD34IX2Z couple more tests
  • [*] 3QNOKBFM beginnings of a test harness
  • [*] 2L4DL7PG go through App in a couple more places

Change contents

  • replacement in source_text.lua at line 48
    [3.367][3.367:578]()
    local filename_text = App.newText(love.graphics.getFont(), filename)
    button(State, 'link', {x=x+App.width(to_text('[[')), y=y, w=App.width(filename_text), h=State.line_height, color={1,1,1},
    [3.367]
    [3.578]
    button(State, 'link', {x=x+App.width('[['), y=y, w=App.width(filename), h=State.line_height, color={1,1,1},
  • edit in source.lua at line 419
    [6.4019][7.177474:177618](),[7.177474][7.177474:177618]()
    end
    end
    -- use this sparingly
    function to_text(s)
    if Text_cache[s] == nil then
    Text_cache[s] = App.newText(love.graphics.getFont(), s)
  • edit in source.lua at line 420
    [7.177624][7.177624:177647]()
    return Text_cache[s]
  • replacement in run.lua at line 200
    [7.183879][7.183879:184041]()
    -- use this sparingly
    function to_text(s)
    if Text_cache[s] == nil then
    Text_cache[s] = App.newText(love.graphics.getFont(), s)
    end
    return Text_cache[s]
    [7.183879]
    [7.184041]
    function width(s)
    return love.graphics.getFont():getWidth(s)
  • edit in log_browser.lua at line 101
    [7.195449][7.195449:195505]()
    local section_text = to_text(line.section_name)
  • replacement in log_browser.lua at line 106
    [7.195813][7.195813:195959]()
    love.graphics.draw(section_text, xleft+50,y)
    love.graphics.line(xleft+50+App.width(section_text)+2,sectiony, xright,sectiony)
    [7.195813]
    [7.195959]
    love.graphics.print(line.section_name, xleft+50,y)
    love.graphics.line(xleft+50+App.width(line.section_name)+2,sectiony, xright,sectiony)
  • replacement in log_browser.lua at line 113
    [7.196252][7.196252:196398]()
    love.graphics.draw(section_text, xleft+50,y)
    love.graphics.line(xleft+50+App.width(section_text)+2,sectiony, xright,sectiony)
    [7.196252]
    [7.196398]
    love.graphics.print(line.section_name, xleft+50,y)
    love.graphics.line(xleft+50+App.width(line.section_name)+2,sectiony, xright,sectiony)
  • replacement in log_browser.lua at line 150
    [7.197661][7.197661:197834]()
    love.graphics.print(line.section_stack[i].name, x+State.font_height+5, App.screen.height-App.width(to_text(line.section_stack[i].name))-5, --[[vertically]] math.pi/2)
    [7.197661]
    [7.197834]
    love.graphics.print(line.section_stack[i].name, x+State.font_height+5, App.screen.height-App.width(line.section_stack[i].name)-5, --[[vertically]] math.pi/2)
  • replacement in log_browser.lua at line 165
    [7.198357][7.198357:198510]()
    love.graphics.print(line.section_stack[i].name, x, App.screen.height-App.width(to_text(line.section_stack[i].name))-5, --[[vertically]] math.pi/2)
    [7.198357]
    [7.198510]
    love.graphics.print(line.section_stack[i].name, x, App.screen.height-App.width(line.section_stack[i].name)-5, --[[vertically]] math.pi/2)
  • replacement in help.lua at line 150
    [7.11371][7.273:307]()
    return App.width(to_text('* '))
    [7.11371]
    [7.11540]
    return App.width('* ')
  • replacement in commands.lua at line 46
    [7.205905][7.29:91]()
    local s_text = to_text(s)
    local width = App.width(s_text)
    [7.205905]
    [5.29]
    local width = App.width(s)
  • replacement in commands.lua at line 51
    [7.206145][7.92:133]()
    App.screen.draw(s_text, Menu_cursor,5)
    [7.206145]
    [7.206193]
    App.screen.print(s, Menu_cursor,5)
  • replacement in commands.lua at line 57
    [7.227][7.227:363]()
    local filter_text = to_text(File_navigation.filter)
    App.screen.draw(filter_text, 5, 5)
    draw_cursor(5 + App.width(filter_text), 5)
    [7.227]
    [7.29]
    App.screen.print(File_navigation.filter, 5, 5)
    draw_cursor(5 + App.width(File_navigation.filter), 5)
  • replacement in commands.lua at line 98
    [4.404][7.29:76](),[7.565][7.29:76]()
    local width = App.width(to_text(filename))
    [4.404]
    [7.76]
    local width = App.width(filename)
  • replacement in commands.lua at line 110
    [7.808][7.134:196](),[7.206600][7.134:196]()
    local s_text = to_text(s)
    local width = App.width(s_text)
    [7.808]
    [7.809]
    local width = App.width(s)
  • replacement in commands.lua at line 125
    [7.207023][7.992:1023]()
    App.screen.draw(s_text, x,y)
    [7.207023]
    [7.1023]
    App.screen.print(s, x,y)
  • replacement in commands.lua at line 189
    [4.972][4.972:1053]()
    local filename_text = to_text(filename)
    width = App.width(filename_text)
    [4.972]
    [4.1053]
    width = App.width(filename)
  • replacement in commands.lua at line 206
    [4.1526][4.1526:1607]()
    local filename_text = to_text(filename)
    width = App.width(filename_text)
    [4.1526]
    [4.1607]
    width = App.width(filename)
  • replacement in commands.lua at line 217
    [4.1984][4.1984:2043]()
    App.screen.draw(filename_text, x + x3-menu_xmin, y3)
    [4.1984]
    [4.2043]
    App.screen.print(filename, x + x3-menu_xmin, y3)
  • replacement in commands.lua at line 244
    [7.863][7.863:910]()
    local width = App.width(to_text(filename))
    [7.863]
    [7.910]
    local width = App.width(filename)
  • replacement in commands.lua at line 262
    [7.1363][7.1363:1410]()
    local width = App.width(to_text(filename))
    [7.1363]
    [7.1410]
    local width = App.width(filename)
  • edit in app.lua at line 222
    [28.296]
    [28.296]
    if type(text) == 'string' then
    return love.graphics.getFont():getWidth(text)
    end
  • replacement in app.lua at line 431
    [7.8106][7.8106:8162]()
    App.width = function(text) return text:getWidth() end
    [7.8106]
    [2.31]
    App.width = function(text)
    if type(text) == 'string' then
    return love.graphics.getFont():getWidth(text)
    end
    return text:getWidth()
    end