bugfix: never use utf8 pos in string.sub

[?]
May 6, 2023, 3:54 PM
ZPQI5UL3V6QIZXWGXO2DZOCCTLIUOQSRP3LIQKEARIQQSNA6RO6AC

Dependencies

  • [2] I64IPGJX avoid saving fragments in lines
  • [3] GZ5WULJV switch source side to new screen-line-based render
  • [4] 3ZYCPNQY clearer copy
  • [5] FZBXBUFF bugfix: search
  • [6] 66X36NZN a little more prose describing manual_tests
  • [7] HALS7E5U more clearly skip prints before screen top
  • [8] KKMFQDR4 editing source code from within the app
  • [9] PIEDOKYQ bugfix
  • [*] BULPIBEG beginnings of a module for the text editor
  • [*] BJ5X5O4A let's prevent the text cursor from ever getting on a drawing

Change contents

  • replacement in text.lua at line 36
    [4.458][4.458:608]()
    if State.lines[State.cursor1.line].data:sub(State.cursor1.pos, State.cursor1.pos+utf8.len(State.search_term)-1) == State.search_term then
    [4.458]
    [2.741]
    local data = State.lines[State.cursor1.line].data
    local cursor_offset = Text.offset(data, State.cursor1.pos)
    if data:sub(cursor_offset, cursor_offset+#State.search_term-1) == State.search_term then
  • replacement in source_text.lua at line 58
    [4.88448][4.88448:88598]()
    if State.lines[State.cursor1.line].data:sub(State.cursor1.pos, State.cursor1.pos+utf8.len(State.search_term)-1) == State.search_term then
    [4.88448]
    [3.1540]
    local data = State.lines[State.cursor1.line].data
    local cursor_offset = Text.offset(data, State.cursor1.pos)
    if data:sub(cursor_offset, cursor_offset+#State.search_term-1) == State.search_term then
  • replacement in Manual_tests.md at line 31
    [4.99][4.99:188]()
    For example, `string.sub` should never use a `_pos` to substring, only an
    `_offset`.
    [4.99]
    [4.252]
    For example, `string.sub` should never use a `_pos`, only an `_offset`.