switch to line index in a function

[?]
Jul 17, 2022, 4:30 PM
HGC5RGJPK34K5HRPG6FB7VIKOT6VTWVEC3CBYS5QVH5LVKAL6WGQC

Dependencies

  • [2] ODLKHO7B switch to line index in a function
  • [3] XNFTJHC4 split keyboard handling between Text and Drawing
  • [4] BOFNXP5G clicking now moves the cursor even on long, wrapped lines
  • [5] PFT5Y2ZY move
  • [6] QYIFOHW3 first test!
  • [7] DGK5BPVI bugfix: UTF-8 in compute_fragments
  • [8] 4VKEE43Z bugfix
  • [9] LAW2O3NW extract variable Margin_left
  • [10] M6TH7VSZ rip out notion of Line_width
  • [11] HOSPP2AN crisp font rendering
  • [12] BYG5CEMV support for naming points
  • [13] 5DOC2CBM extract a function
  • [14] MDXGMZU2 disable all debug prints
  • [15] FKNXK2OA switch to line index in a function
  • [16] HYEAFRZ2 split mouse_pressed events between Text and Drawing
  • [17] CVGE3SIG I feel confident now that page-down is working.
  • [18] QCPXQ2E3 add state arg to a few functions
  • [19] IMEJA43L snapshot
  • [20] P66MRF3U bugfix: don't append metadata when it already exists
  • [21] LERERVPH keep one screen line of overlap on pagedown
  • [22] 5FW7YOFT highlight selection while dragging
  • [23] NDHQN23G done passing left/right margins everywhere
  • [24] K4OBZSHE add args to some functions
  • [25] R53OF3ON one bug I've repeatedly run into while testing with Moby Dick
  • [26] MXA3RZYK deduce left/right from state where possible
  • [27] U52E2XZN fix a crash
  • [28] PESSMQBJ no, make sure to compute line width after screen dimensions
  • [29] LXTTOB33 extract a couple of files
  • [30] H2DPLWMV snapshot: wrapping long lines at word boundaries
  • [31] 5DOTWNVM right margin
  • [*] BULPIBEG beginnings of a module for the text editor

Change contents

  • replacement in text.lua at line 22
    [3.1850][3.77:135]()
    Text.compute_fragments(line, State.left, State.right)
    [3.1850]
    [3.103]
    Text.compute_fragments(State, line_index)
  • replacement in text.lua at line 95
    [3.42][3.50:141]()
    function Text.compute_fragments(line, left, right)
    --? print('compute_fragments', right)
    [3.42]
    [3.51]
    function Text.compute_fragments(State, line_index)
    --? print('compute_fragments', State.right)
    local line = State.lines[line_index]
  • replacement in text.lua at line 99
    [3.73][3.142:159]()
    local x = left
    [3.73]
    [3.88]
    local x = State.left
  • replacement in text.lua at line 104
    [3.2940][3.160:231]()
    --? print('x: '..tostring(x)..'; '..tostring(right-x)..'px to go')
    [3.2940]
    [3.380]
    --? print('x: '..tostring(x)..'; '..tostring(State.right-x)..'px to go')
  • replacement in text.lua at line 106
    [3.453][3.232:429]()
    if x + frag_width > right then
    while x + frag_width > right do
    --? print(x, frag, frag_width, right)
    if x < 0.8*right then
    --? print(frag, x, frag_width, right)
    [3.453]
    [3.571]
    if x + frag_width > State.right then
    while x + frag_width > State.right do
    --? print(x, frag, frag_width, State.right)
    if x < 0.8*State.right then
    --? print(frag, x, frag_width, State.right)
  • replacement in text.lua at line 113
    [3.672][3.430:497]()
    local bpos = Text.nearest_pos_less_than(frag, right - x)
    [3.672]
    [3.833]
    local bpos = Text.nearest_pos_less_than(frag, State.right - x)
  • replacement in text.lua at line 120
    [3.2993][3.498:590]()
    --? print(frag, x, frag1_width, right)
    assert(x + frag1_width <= right)
    [3.2993]
    [3.998]
    --? print(frag, x, frag1_width, State.right)
    assert(x + frag1_width <= State.right)
  • replacement in text.lua at line 128
    [3.1339][3.591:621]()
    x = left -- new line
    [3.1339]
    [3.1367]
    x = State.left -- new line
  • replacement in text.lua at line 710
    [3.35][3.3092:3150]()
    Text.compute_fragments(line, State.left, State.right)
    [3.35]
    [3.80]
    Text.compute_fragments(State, line_index)
  • replacement in text.lua at line 921
    [3.2315][2.713:771]()
    Text.compute_fragments(line, State.left, State.right)
    [3.2315]
    [3.2360]
    Text.compute_fragments(State, line_index)