drop an unnecessary level of indent

[?]
Jul 20, 2022, 2:02 PM
UPCIYZEUIFO2UJ3WPAFOD7VLNZEIIYYGJQGEMJOP5TSSE5PM4ZWAC

Dependencies

  • [2] KURLAXXI clean up some prints
  • [3] HOSPP2AN crisp font rendering
  • [4] MP2TBKU6 bugfix: crash in Text.up() after return
  • [5] 5DOTWNVM right margin
  • [6] ILOA5BYF separate data structure for each line's cache data
  • [7] DGK5BPVI bugfix: UTF-8 in compute_fragments
  • [8] MDXGMZU2 disable all debug prints
  • [9] NDHQN23G done passing left/right margins everywhere
  • [10] IMEJA43L snapshot
  • [11] PFT5Y2ZY move
  • [12] R5OKMVVC fix a regression in line wrapping
  • [13] LAW2O3NW extract variable Margin_left
  • [14] QYIFOHW3 first test!
  • [15] M6TH7VSZ rip out notion of Line_width
  • [16] HGC5RGJP switch to line index in a function
  • [*] BULPIBEG beginnings of a module for the text editor

Change contents

  • replacement in text.lua at line 99
    [3.453][3.289:374](),[3.374][2.156:282](),[2.282][3.426:462](),[3.426][3.426:462](),[3.462][2.283:316](),[2.316][3.571:672](),[3.429][3.571:672](),[3.451][3.571:672](),[3.516][3.571:672](),[3.1545][3.571:672](),[3.4219][3.571:672](),[3.6846][3.571:672](),[3.571][3.571:672](),[3.672][3.517:590](),[3.590][2.317:351](),[2.351][3.833:910](),[3.497][3.833:910](),[3.590][3.833:910](),[3.1624][3.833:910](),[3.4311][3.833:910](),[3.833][3.833:910](),[3.910][3.3:77](),[3.77][2.352:449](),[2.449][3.1105:1160](),[3.1105][3.1105:1160](),[3.1160][3.809:882](),[3.846][3.809:882](),[3.882][3.2941:2993](),[3.2993][2.450:537](),[2.537][3.646:695](),[3.646][3.646:695](),[3.1082][3.3991:4067](),[3.4067][3.1161:1204](),[3.1152][3.1161:1204](),[3.1204][3.952:1017](),[3.1191][3.952:1017](),[3.1017][3.2994:3038](),[3.1078][3.1327:1339](),[3.3038][3.1327:1339](),[3.1327][3.1327:1339](),[3.1339][3.696:732]()
    if x + frag_width > State.right then
    while x + frag_width > State.right do
    --? print(('checking whether to split fragment ^%s$ of width %d when rendering from %d'):format(frag, frag_width, x))
    if x < 0.8*State.right then
    --? print('splitting')
    -- long word; chop it at some letter
    -- We're not going to reimplement TeX here.
    local bpos = Text.nearest_pos_less_than(frag, State.right - x)
    --? print('bpos', bpos)
    assert(bpos > 0) -- avoid infinite loop when window is too narrow
    local boffset = Text.offset(frag, bpos+1) -- byte _after_ bpos
    --? print('space for '..tostring(bpos)..' graphemes, '..tostring(boffset-1)..' bytes')
    local frag1 = string.sub(frag, 1, boffset-1)
    local frag1_text = App.newText(love.graphics.getFont(), frag1)
    local frag1_width = App.width(frag1_text)
    --? print('extracting ^'..frag1..'$ of width '..tostring(frag1_width)..'px')
    assert(x + frag1_width <= State.right)
    table.insert(line_cache.fragments, {data=frag1, text=frag1_text})
    frag = string.sub(frag, boffset)
    frag_text = App.newText(love.graphics.getFont(), frag)
    frag_width = App.width(frag_text)
    end
    x = State.left -- new line
    [3.288]
    [3.1367]
    while x + frag_width > State.right do
    --? print(('checking whether to split fragment ^%s$ of width %d when rendering from %d'):format(frag, frag_width, x))
    if x < 0.8*State.right then
    --? print('splitting')
    -- long word; chop it at some letter
    -- We're not going to reimplement TeX here.
    local bpos = Text.nearest_pos_less_than(frag, State.right - x)
    --? print('bpos', bpos)
    assert(bpos > 0) -- avoid infinite loop when window is too narrow
    local boffset = Text.offset(frag, bpos+1) -- byte _after_ bpos
    --? print('space for '..tostring(bpos)..' graphemes, '..tostring(boffset-1)..' bytes')
    local frag1 = string.sub(frag, 1, boffset-1)
    local frag1_text = App.newText(love.graphics.getFont(), frag1)
    local frag1_width = App.width(frag1_text)
    --? print('extracting ^'..frag1..'$ of width '..tostring(frag1_width)..'px')
    assert(x + frag1_width <= State.right)
    table.insert(line_cache.fragments, {data=frag1, text=frag1_text})
    frag = string.sub(frag, boffset)
    frag_text = App.newText(love.graphics.getFont(), frag)
    frag_width = App.width(frag_text)
  • edit in text.lua at line 120
    [3.1377]
    [3.1377]
    x = State.left -- new line