fix a couple of asserts missed in the recent audit

akkartik
Dec 9, 2023, 5:33 PM
AYG2PQCGAULRJSECW6TEOJMAKH3ZLWJ2ND4DVWC5II3BCV3IGAIQC

Dependencies

  • [2] G3DLS5OU audit all asserts
  • [3] MP2TBKU6 bugfix: crash in Text.up() after return
  • [4] LF7BWEG4 group all editor globals
  • [5] IFTYOERM line.y -> line_cache.starty in a few more places
  • [6] QCPXQ2E3 add state arg to a few functions
  • [7] KKMFQDR4 editing source code from within the app
  • [8] 73OCE2MC after much struggle, a brute-force undo
  • [9] GGWAHCLE minor cleanup and a todo for later
  • [*] BULPIBEG beginnings of a module for the text editor

Change contents

  • edit in undo.lua at line 68
    [3.2245][3.2245:2268]()
    print(line.mode)
  • replacement in text.lua at line 915
    [3.77212][3.1095:1118](),[3.1095][3.1095:1118]()
    print(pos1, #s, s)
    [3.1005]
    [3.1118]
    assert(false, ('Text.offset(%d) called on a string of length %d (byte size %d); this is likely a failure to handle utf8\n\n^%s$\n'):format(pos1, utf8.len(s), #s, s))
  • edit in text.lua at line 917
    [3.1124][2.2231:2317]()
    assert(result, "Text.offset returned nil; this is likely a failure to handle utf8")
  • replacement in source_text.lua at line 977
    [3.142294][3.142294:142317]()
    print(pos1, #s, s)
    [3.142294]
    [3.142317]
    assert(false, ('Text.offset(%d) called on a string of length %d (byte size %d); this is likely a failure to handle utf8\n\n^%s$\n'):format(pos1, utf8.len(s), #s, s))
  • edit in source_text.lua at line 979
    [3.142323][2.4549:4635]()
    assert(result, "Text.offset returned nil; this is likely a failure to handle utf8")