eliminate assumptions that line length == size in bytes

[?]
May 20, 2022, 12:46 AM
DAENUOGV7KR6MZVXS36HEN3SZC4RFIS6REGAFVBOFEPO76EUDGIAC

Dependencies

  • [2] A2TQYJ6J .
  • [3] H2DPLWMV snapshot: wrapping long lines at word boundaries
  • [4] B3IWYWSR delete another arg that can be deduced
  • [5] JCSLDGAH beginnings of support for multiple shapes
  • [6] VVXVV2D2 change data model; text can now have metadata
  • [7] DLQMM265 scroll past first page
  • [8] UWNHC4AA redo y computations
  • [9] MGOQ5XAV start uppercasing globals
  • [10] XNFTJHC4 split keyboard handling between Text and Drawing
  • [11] IYW7X3WL left/right cursor movement, deleting characters
  • [12] 4C375P53 this is a bit clearer
  • [13] AVQ5MC5D finish uppercasing all globals
  • [14] 2ZYV7D3W handle tab characters
  • [15] BULPIBEG beginnings of a module for the text editor
  • [16] HYEAFRZ2 split mouse_pressed events between Text and Drawing
  • [*] OTIBCAUJ love2d scaffold

Change contents

  • replacement in text.lua at line 42
    [3.1642][3.1642:1746]()
    love.graphics.setColor(0.75,0.75,0.75)
    love.graphics.line(line_width, 0, line_width, Screen_height)
    [3.1642]
    [4.109]
    --? love.graphics.setColor(0.75,0.75,0.75)
    --? love.graphics.line(line_width, 0, line_width, Screen_height)
  • replacement in text.lua at line 122
    [4.1365][4.1365:1415]()
    Cursor_pos = #Lines[Cursor_line].data+1
    [4.1365]
    [4.1415]
    Cursor_pos = utf8.len(Lines[Cursor_line].data) + 1
  • replacement in text.lua at line 132
    [4.1538][4.1538:1589]()
    if Cursor_pos <= #Lines[Cursor_line].data then
    [4.1538]
    [4.1589]
    if Cursor_pos <= utf8.len(Lines[Cursor_line].data) then
  • replacement in text.lua at line 151
    [4.2002][4.2002:2046]()
    Cursor_pos = #Lines[Cursor_line].data+1
    [4.2002]
    [4.2046]
    Cursor_pos = utf8.len(Lines[Cursor_line].data) + 1
  • replacement in text.lua at line 179
    [4.3066][4.3066:3117]()
    if Cursor_pos <= #Lines[Cursor_line].data then
    [4.3066]
    [4.3117]
    if Cursor_pos <= utf8.len(Lines[Cursor_line].data) then
  • replacement in text.lua at line 282
    [4.553][4.553:598]()
    local max_x = Text.cursor_x(line, #line+1)
    [4.553]
    [4.598]
    local len = utf8.len(line)
    local max_x = Text.cursor_x(line, len+1)
  • replacement in text.lua at line 285
    [4.618][4.618:637]()
    return #line+1
    [4.618]
    [4.637]
    return len+1
  • replacement in text.lua at line 293
    [4.745][4.745:778]()
    local left, right = 1, #line+1
    [4.745]
    [4.360]
    local left, right = 1, len+1
  • replacement in main.lua at line 47
    [4.148][2.3:69]()
    Cursor_pos = #Lines[Cursor_line].data+1 -- in Unicode codepoints
    [4.148]
    [4.1238]
    Cursor_pos = 1 -- in Unicode codepoints
  • replacement in main.lua at line 136
    [4.213][3.3298:3452]()
    y = Text.draw(line, 100, line_index, Cursor_line, Cursor_pos)
    --? y = Text.draw(line, Drawing_width, line_index, Cursor_line, Cursor_pos)
    [4.213]
    [4.56]
    --? y = Text.draw(line, 100, line_index, Cursor_line, Cursor_pos)
    y = Text.draw(line, Drawing_width, line_index, Cursor_line, Cursor_pos)