App.width can no longer take a Text

[?]
Apr 1, 2023, 11:29 PM
ISOFHXB2DX6IRN4HVBYWLADZM7QXQKRNAAS577G542KS4L6G5H3QC

Dependencies

  • [2] 6WDBV52Z move a var closer to its use
  • [3] BE3WIEVK update cursor in search box
  • [4] OYVFFWBK move
  • [5] R3KXFRZN get rid of to_text
  • [6] 356GY7IQ unify two similar functions
  • [7] B4JEWKWI hide editor cursor while in file navigator
  • [8] IFTYOERM line.y -> line_cache.starty in a few more places
  • [9] 7JH2ZT3F add state arg to Drawing.draw
  • [10] 5ZA3BRNY add state arg to a few functions
  • [11] TXHMMX25 move caching behavior inside compute_fragments
  • [12] 5DOTWNVM right margin
  • [13] AH744RFR show when we're naming a point
  • [14] QCPXQ2E3 add state arg to a few functions
  • [15] M6TH7VSZ rip out notion of Line_width
  • [16] MYC7XR5Q bugfix: lines that aren't drawn from the start
  • [17] RRDO6H7H bugfix
  • [18] FHSZYAZ2 more precise search highlighting
  • [19] 2L5MEZV3 experiment: new edit namespace
  • [20] ILOA5BYF separate data structure for each line's cache data
  • [21] MTJEVRJR add state arg to a few functions
  • [22] HALS7E5U more clearly skip prints before screen top
  • [23] JLU2RMC4 allow Text.nearest_pos_less_than to return 0
  • [24] MP2TBKU6 bugfix: crash in Text.up() after return
  • [25] F3NPUCCM update stale information
  • [26] CQYKYJJU remember window positions across restart/ctrl+e
  • [27] LXTTOB33 extract a couple of files
  • [28] IWYLK45K clicking to the right of a line within line width
  • [29] UHB4GARJ left/right margin -> left/right coordinates
  • [30] H22OAXWE couple of TODOs
  • [31] AVTNUQYR basic test-enabled framework
  • [32] HGC5RGJP switch to line index in a function
  • [33] JMUD7T3O get rid of ugly side-effects in tests
  • [34] HIKLULFQ extract a function
  • [35] TYFAGQWS repeat bugfix on source editor
  • [36] IX5YTLSV state validation in source editor as well
  • [37] KMSL74GA support selections in the source editor
  • [38] 4EGQRXDA bugfix: naming points
  • [39] PV2YA7KS subsection headings in a long switch
  • [40] 4J4TX7IS get typed in keystrokes to show on screen on iPad
  • [41] 4KC7I3E2 make colors easier to edit
  • [42] 2CK5QI7W make love event names consistent
  • [43] YRJFJNUD bugfix
  • [44] X3F7ECSL add state arg to some functions
  • [45] AJB4LFRB try to maintain a reasonable line width
  • [46] 2L4DL7PG go through App in a couple more places
  • [47] HOSPP2AN crisp font rendering
  • [48] LNUHQOGH start passing in Editor_state explicitly
  • [49] G54H3YG2 get rid of all bifold text
  • [50] 5DOC2CBM extract a function
  • [51] UPCIYZEU drop an unnecessary level of indent
  • [52] S2MISTTM add state arg to a few functions
  • [53] 2WGHUWE6 self-documenting 0 Test_right_margin
  • [54] AOZX2G5F source: no commandline args
  • [55] PFT5Y2ZY move
  • [56] LIKTH6HM update stale source X-(
  • [57] LF7BWEG4 group all editor globals
  • [58] PX7DDEMO autosave slightly less aggressively
  • [59] QYIFOHW3 first test!
  • [60] OI4FPFIN support drawings in the source editor
  • [61] HKV72RZV bugfix: save modified files in save directory
  • [62] NDHQN23G done passing left/right margins everywhere
  • [63] GL4Q5WCV keep text from overflowing right margin
  • [64] EGH7XDBK support non-text lines in Text.to2
  • [65] H6QZ7GRR more precise name
  • [66] 5RDWSYK2 consistently use App names for methods everywhere
  • [67] IMEJA43L snapshot
  • [68] MXA3RZYK deduce left/right from state where possible
  • [69] VSBSWTE4 bugfix: where cursor is drawn
  • [70] 2Y7YH7UP infrastructure for caching LÖVE text objects
  • [71] EAEGCJV5 rename
  • [72] KKMFQDR4 editing source code from within the app
  • [73] ZJOSQFN6 bugfix: path munging on Windows
  • [*] BULPIBEG beginnings of a module for the text editor
  • [*] BLWAYPKV extract a module
  • [*] 3QNOKBFM beginnings of a test harness

Change contents

  • replacement in text.lua at line 26
    [2.28][2.28:74]()
    local frag_width = App.width(frag_text)
    [2.28]
    [6.138]
    local frag_width = App.width(f.data)
  • replacement in text.lua at line 93
    [4.594][4.594:638]()
    local frag_width = App.width(frag_text)
    [4.594]
    [4.638]
    local frag_width = App.width(f.data)
  • replacement in text.lua at line 117
    [6.747][6.2896:2940]()
    local frag_width = App.width(frag_text)
    [6.747]
    [6.3]
    local frag_width = App.width(frag)
  • replacement in text.lua at line 132
    [6.800][6.800:850]()
    local frag1_width = App.width(frag1_text)
    [6.800]
    [6.850]
    local frag1_width = App.width(frag1)
  • replacement in text.lua at line 138
    [6.1160][6.1160:1202]()
    frag_width = App.width(frag_text)
    [6.1160]
    [6.1367]
    frag_width = App.width(frag)
  • replacement in text.lua at line 762
    [6.1530][6.1530:1644]()
    local screen_line_text = App.newText(love.graphics.getFont(), screen_line)
    return App.width(screen_line_text)
    [6.1530]
    [6.1649]
    return App.width(screen_line)
  • replacement in text.lua at line 850
    [6.3817][6.3817:3918]()
    local text_before = App.newText(love.graphics.getFont(), s_before)
    return App.width(text_before)
    [6.3817]
    [6.7876]
    return App.width(s_before)
  • replacement in text.lua at line 856
    [6.1333][6.1333:1434]()
    local text_before = App.newText(love.graphics.getFont(), s_before)
    return App.width(text_before)
    [6.1333]
    [6.1434]
    return App.width(s_before)
  • replacement in source_text.lua at line 29
    [6.87793][6.87793:87839]()
    local frag_width = App.width(frag_text)
    [6.87793]
    [6.87839]
    local frag_width = App.width(f.data)
  • replacement in source_text.lua at line 109
    [6.91878][6.91878:91922]()
    local frag_width = App.width(frag_text)
    [6.91878]
    [6.91922]
    local frag_width = App.width(f.data)
  • replacement in source_text.lua at line 133
    [6.92613][6.92613:92657]()
    local frag_width = App.width(frag_text)
    [6.92613]
    [6.92657]
    local frag_width = App.width(frag)
  • replacement in source_text.lua at line 148
    [6.93610][6.93610:93660]()
    local frag1_width = App.width(frag1_text)
    [6.93610]
    [6.93660]
    local frag1_width = App.width(frag1)
  • replacement in source_text.lua at line 154
    [6.93970][6.93970:94012]()
    frag_width = App.width(frag_text)
    [6.93970]
    [6.94012]
    frag_width = App.width(frag)
  • replacement in source_text.lua at line 778
    [6.135976][6.135976:136090]()
    local screen_line_text = App.newText(love.graphics.getFont(), screen_line)
    return App.width(screen_line_text)
    [6.135976]
    [6.136090]
    return App.width(screen_line)
  • replacement in source_text.lua at line 866
    [6.139549][6.139549:139650]()
    local text_before = App.newText(love.graphics.getFont(), s_before)
    return App.width(text_before)
    [6.139549]
    [6.139650]
    return App.width(s_before)
  • replacement in source_text.lua at line 872
    [6.139754][6.139754:139855]()
    local text_before = App.newText(love.graphics.getFont(), s_before)
    return App.width(text_before)
    [6.139754]
    [6.139855]
    return App.width(s_before)
  • replacement in source_select.lua at line 63
    [6.25854][6.25854:25962]()
    local before_text = App.newText(love.graphics.getFont(), before)
    lo_px = App.width(before_text)
    [6.25854]
    [6.25962]
    lo_px = App.width(before)
  • edit in source_select.lua at line 67
    [6.26098][6.26098:26194]()
    local text = App.newText(love.graphics.getFont(), s)
    local text_width = App.width(text)
  • replacement in source_select.lua at line 68
    [6.26225][6.26225:26302]()
    love.graphics.rectangle('fill', x+lo_px,y, text_width,State.line_height)
    [6.26225]
    [6.26302]
    love.graphics.rectangle('fill', x+lo_px,y, App.width(s),State.line_height)
  • edit in source_edit.lua at line 107
    [6.155208][6.155208:155231]()
    search_text = nil,
  • edit in source_edit.lua at line 327
    [6.157970][6.157970:157998]()
    State.search_text = nil
  • edit in source_edit.lua at line 357
    [6.158234][6.158234:158264]()
    State.search_text = nil
  • edit in source_edit.lua at line 363
    [6.158563][6.158563:158593]()
    State.search_text = nil
  • edit in source_edit.lua at line 368
    [6.158844][6.158844:158874]()
    State.search_text = nil
  • edit in source_edit.lua at line 381
    [6.159452][6.159452:159489]()
    assert(State.search_text == nil)
  • edit in source_edit.lua at line 512
    [6.164115][6.164115:164170]()
    State.em = App.newText(love.graphics.getFont(), 'm')
  • replacement in source.lua at line 165
    [6.170082][6.170082:170188]()
    local em = App.newText(love.graphics.getFont(), 'm')
    source.initialize_window_geometry(App.width(em))
    [6.170082]
    [6.170188]
    source.initialize_window_geometry(App.width('m'))
  • edit in source.lua at line 170
    [6.170381][6.170381:170404]()
    Editor_state.em = em
  • replacement in select.lua at line 61
    [6.514][6.514:622]()
    local before_text = App.newText(love.graphics.getFont(), before)
    lo_px = App.width(before_text)
    [6.514]
    [6.622]
    lo_px = App.width(before)
  • edit in select.lua at line 65
    [6.758][6.758:854]()
    local text = App.newText(love.graphics.getFont(), s)
    local text_width = App.width(text)
  • replacement in select.lua at line 66
    [6.152][6.939:1016]()
    love.graphics.rectangle('fill', x+lo_px,y, text_width,State.line_height)
    [6.152]
    [6.153]
    love.graphics.rectangle('fill', x+lo_px,y, App.width(s),State.line_height)
  • replacement in search.lua at line 16
    [6.232][6.1672:1787](),[6.1787][6.49593:49599](),[6.82027][6.49593:49599](),[6.49593][6.49593:49599](),[6.49599][3.6:69]()
    if State.search_text == nil then
    State.search_text = App.newText(love.graphics.getFont(), State.search_term)
    end
    Text.draw_cursor(State, 25+App.width(State.search_text),y-5)
    [6.1671]
    [6.49698]
    Text.draw_cursor(State, 25+App.width(State.search_term),y-5)
  • replacement in run.lua at line 74
    [6.180430][6.180430:180533]()
    local em = App.newText(love.graphics.getFont(), 'm')
    run.initialize_window_geometry(App.width(em))
    [6.180430]
    [6.180533]
    run.initialize_window_geometry(App.width('m'))
  • edit in run.lua at line 78
    [6.180726][6.180726:180749]()
    Editor_state.em = em
  • edit in edit.lua at line 106
    [6.97772][6.97772:97795]()
    search_text = nil,
  • edit in edit.lua at line 326
    [6.6467][6.6467:6495]()
    State.search_text = nil
  • edit in edit.lua at line 356
    [6.7016][6.7016:7046]()
    State.search_text = nil
  • edit in edit.lua at line 362
    [6.7215][6.7215:7245]()
    State.search_text = nil
  • edit in edit.lua at line 367
    [6.7460][6.7460:7490]()
    State.search_text = nil
  • edit in edit.lua at line 380
    [6.25412][6.7718:7755](),[6.7718][6.7718:7755]()
    assert(State.search_text == nil)
  • edit in edit.lua at line 511
    [6.387][6.387:442]()
    State.em = App.newText(love.graphics.getFont(), 'm')
  • replacement in drawing.lua at line 63
    [6.1244][6.347:373](),[6.347][6.347:373](),[6.373][6.94:157]()
    local name_text
    -- TODO: avoid computing name width on every repaint
    [6.1244]
    [6.373]
    local name_width
  • replacement in drawing.lua at line 65
    [6.404][6.1082:1115]()
    name_text = State.em
    [6.404]
    [6.488]
    name_width = App.width('m')
  • replacement in drawing.lua at line 67
    [6.503][6.86:155]()
    name_text = App.newText(love.graphics.getFont(), p.name)
    [6.503]
    [6.582]
    name_width = App.width(p.name)
  • replacement in drawing.lua at line 69
    [6.596][6.1116:1204]()
    love.graphics.rectangle('fill', x,y, App.width(name_text), State.line_height)
    [6.596]
    [6.703]
    love.graphics.rectangle('fill', x,y, name_width, State.line_height)
  • replacement in app.lua at line 222
    [6.296][5.1339:1428](),[5.1428][6.296:326](),[6.296][6.296:326]()
    if type(text) == 'string' then
    return love.graphics.getFont():getWidth(text)
    end
    return text.text:getWidth()
    [6.296]
    [6.6717]
    return love.graphics.getFont():getWidth(text)
  • edit in app.lua at line 428
    [6.8106][5.1429:1586]()
    App.width = function(text)
    if type(text) == 'string' then
    return love.graphics.getFont():getWidth(text)
    end
    return text:getWidth()
    end