bugfix: searching files containing unicode

[?]
May 14, 2023, 12:02 AM
2H76FV5SK3ZWFVQ6ISAOSUJQWW4SSNPRDEI75JIQAJRPIVWPOCDAC

Dependencies

  • [2] QSKWIEU3 support special chars like '(' in search
  • [3] ORRSP7FV deduce test names on failures
  • [4] LF7BWEG4 group all editor globals
  • [5] 5ZA3BRNY add state arg to a few functions
  • [6] LXTTOB33 extract a couple of files
  • [7] MSOQI3A5 bugfix: check before cursor on same line
  • [8] AMOPICKV bugfix: check after cursor on same line when searching upwards
  • [9] LLAOOMUL bugfix: search upwards
  • [10] 7PZ4CQFV search: transparently handle drawings everywhere
  • [11] OI4FPFIN support drawings in the source editor
  • [12] KKMFQDR4 editing source code from within the app
  • [13] FZBXBUFF bugfix: search
  • [14] EETIR4GX bugfix: skip over drawings when searching
  • [15] 2CK5QI7W make love event names consistent

Change contents

  • replacement in text_tests.lua at line 1988
    [4.140][4.2:76]()
    Editor_state.lines = load_array{'```lines', '```', 'def', 'ghi', 'deg'}
    [4.140]
    [4.202]
    Editor_state.lines = load_array{'```lines', '```', 'def', 'ghi', '’deg'} -- contains unicode quote in final line
  • replacement in text_tests.lua at line 2009
    [3.22894][3.22894:22950]()
    check_eq(Editor_state.cursor1.pos, 1, '2/cursor:pos')
    [3.22894]
    [4.1423]
    check_eq(Editor_state.cursor1.pos, 2, '2/cursor:pos')
  • replacement in text_tests.lua at line 2015
    [4.155][4.155:200]()
    Editor_state.lines = load_array{'abc abd'}
    [4.155]
    [4.200]
    Editor_state.lines = load_array{'’abc', 'abd'} -- contains unicode quote
  • replacement in text_tests.lua at line 2017
    [4.232][4.232:273]()
    Editor_state.cursor1 = {line=1, pos=2}
    [4.232]
    [4.273]
    Editor_state.cursor1 = {line=2, pos=1}
  • replacement in text_tests.lua at line 2027
    [3.23009][3.23009:23065]()
    check_eq(Editor_state.cursor1.pos, 1, '2/cursor:pos')
    [3.23009]
    [4.741]
    check_eq(Editor_state.cursor1.pos, 2, '2/cursor:pos')
  • replacement in text_tests.lua at line 2033
    [4.150][4.150:191]()
    Editor_state.lines = load_array{'abc'}
    [4.150]
    [4.191]
    Editor_state.lines = load_array{'’abc', 'def'} -- contains unicode quote in first line
  • replacement in text_tests.lua at line 2035
    [4.223][4.223:264]()
    Editor_state.cursor1 = {line=1, pos=3}
    [4.223]
    [4.264]
    Editor_state.cursor1 = {line=2, pos=1}
  • replacement in text_tests.lua at line 2045
    [3.23124][3.23124:23180]()
    check_eq(Editor_state.cursor1.pos, 1, '1/cursor:pos')
    [3.23124]
    [4.712]
    check_eq(Editor_state.cursor1.pos, 2, '1/cursor:pos')
  • replacement in text_tests.lua at line 2051
    [4.166][4.166:211]()
    Editor_state.lines = load_array{'abc abd'}
    [4.166]
    [4.211]
    Editor_state.lines = load_array{'abc ’abd'} -- contains unicode quote
  • replacement in text_tests.lua at line 2063
    [3.23239][3.23239:23295]()
    check_eq(Editor_state.cursor1.pos, 5, '1/cursor:pos')
    [3.23239]
    [4.752]
    check_eq(Editor_state.cursor1.pos, 6, '1/cursor:pos')
  • replacement in source_text_tests.lua at line 1958
    [4.80428][4.5257:5331]()
    Editor_state.lines = load_array{'```lines', '```', 'def', 'ghi', 'deg'}
    [4.80428]
    [4.80490]
    Editor_state.lines = load_array{'```lines', '```', 'def', 'ghi', '’deg'} -- contains unicode quote in final line
  • replacement in source_text_tests.lua at line 1979
    [3.45740][3.45740:45796]()
    check_eq(Editor_state.cursor1.pos, 1, '2/cursor:pos')
    [3.45740]
    [4.81459]
    check_eq(Editor_state.cursor1.pos, 2, '2/cursor:pos')
  • replacement in source_text_tests.lua at line 1985
    [4.81617][4.81617:81662]()
    Editor_state.lines = load_array{'abc abd'}
    [4.81617]
    [4.81662]
    Editor_state.lines = load_array{'’abc', 'abd'} -- contains unicode quote
  • replacement in source_text_tests.lua at line 1987
    [4.81694][4.81694:81735]()
    Editor_state.cursor1 = {line=1, pos=2}
    [4.81694]
    [4.81735]
    Editor_state.cursor1 = {line=2, pos=1}
  • replacement in source_text_tests.lua at line 1997
    [3.45855][3.45855:45911]()
    check_eq(Editor_state.cursor1.pos, 1, '2/cursor:pos')
    [3.45855]
    [4.82203]
    check_eq(Editor_state.cursor1.pos, 2, '2/cursor:pos')
  • replacement in source_text_tests.lua at line 2003
    [4.82355][4.82355:82396]()
    Editor_state.lines = load_array{'abc'}
    [4.82355]
    [4.82396]
    Editor_state.lines = load_array{'’abc', 'def'} -- contains unicode quote in first line
  • replacement in source_text_tests.lua at line 2005
    [4.82428][4.82428:82469]()
    Editor_state.cursor1 = {line=1, pos=3}
    [4.82428]
    [4.82469]
    Editor_state.cursor1 = {line=2, pos=1}
  • replacement in source_text_tests.lua at line 2015
    [3.45970][3.45970:46026]()
    check_eq(Editor_state.cursor1.pos, 1, '1/cursor:pos')
    [3.45970]
    [4.82917]
    check_eq(Editor_state.cursor1.pos, 2, '1/cursor:pos')
  • replacement in source_text_tests.lua at line 2021
    [4.83085][4.83085:83130]()
    Editor_state.lines = load_array{'abc abd'}
    [4.83085]
    [4.83130]
    Editor_state.lines = load_array{'abc ’abd'} -- contains unicode quote
  • replacement in source_text_tests.lua at line 2033
    [3.46085][3.46085:46141]()
    check_eq(Editor_state.cursor1.pos, 5, '1/cursor:pos')
    [3.46085]
    [4.83671]
    check_eq(Editor_state.cursor1.pos, 6, '1/cursor:pos')
  • replacement in search.lua at line 21
    [4.758][2.14:129](),[2.129][4.101:143](),[4.101][4.101:143]()
    local pos = find(State.lines[State.cursor1.line].data, State.search_term, State.cursor1.pos, --[[literal]] true)
    if pos then
    State.cursor1.pos = pos
    [4.758]
    [4.49862]
    local curr_pos = State.cursor1.pos
    local curr_line = State.lines[State.cursor1.line].data
    local curr_offset = Text.offset(curr_line, curr_pos)
    local offset = find(curr_line, State.search_term, curr_offset, --[[literal]] true)
    if offset then
    State.cursor1.pos = utf8.len(curr_line, 1, offset)
  • replacement in search.lua at line 28
    [4.49868][4.49868:49889]()
    if pos == nil then
    [4.49868]
    [4.759]
    if offset == nil then
  • replacement in search.lua at line 31
    [4.211][2.130:229](),[2.229][4.201:219](),[4.201][4.201:219](),[4.219][4.177689:177731]()
    pos = find(State.lines[i].data, State.search_term, --[[from start]] nil, --[[literal]] true)
    if pos then
    State.cursor1 = {line=i, pos=pos}
    [4.211]
    [4.282]
    local curr_line = State.lines[i].data
    offset = find(curr_line, State.search_term, --[[from start]] nil, --[[literal]] true)
    if offset then
    State.cursor1 = {line=i, pos=utf8.len(curr_line, 1, offset)}
  • replacement in search.lua at line 39
    [4.50075][4.50075:50096]()
    if pos == nil then
    [4.50075]
    [4.50096]
    if offset == nil then
  • replacement in search.lua at line 42
    [4.368][2.230:329](),[2.329][4.50189:50207](),[4.354][4.50189:50207](),[4.424][4.50189:50207](),[4.82591][4.50189:50207](),[4.50189][4.50189:50207](),[4.50207][4.177732:177774]()
    pos = find(State.lines[i].data, State.search_term, --[[from start]] nil, --[[literal]] true)
    if pos then
    State.cursor1 = {line=i, pos=pos}
    [4.368]
    [4.50258]
    local curr_line = State.lines[i].data
    offset = find(curr_line, State.search_term, --[[from start]] nil, --[[literal]] true)
    if offset then
    State.cursor1 = {line=i, pos=utf8.len(curr_line, 1, offset)}
  • replacement in search.lua at line 50
    [4.50296][4.50296:50317]()
    if pos == nil then
    [4.50296]
    [4.793]
    if offset == nil then
  • replacement in search.lua at line 52
    [4.833][2.330:444]()
    pos = find(State.lines[State.cursor1.line].data, State.search_term, --[[from start]] nil, --[[literal]] true)
    [4.833]
    [4.427]
    local curr_line = State.lines[State.cursor1.line].data
    offset = find(curr_line, State.search_term, --[[from start]] nil, --[[literal]] true)
    local pos = utf8.len(curr_line, 1, offset)
  • replacement in search.lua at line 59
    [4.1062][4.1062:1083]()
    if pos == nil then
    [4.1062]
    [4.489]
    if offset == nil then
  • replacement in search.lua at line 74
    [4.800][2.445:563](),[2.563][4.50856:50870](),[4.849][4.50856:50870](),[4.1169][4.50856:50870](),[4.83452][4.50856:50870](),[4.50856][4.50856:50870](),[4.50870][4.1170:1198]()
    local pos = rfind(State.lines[State.cursor1.line].data, State.search_term, State.cursor1.pos-1, --[[literal]] true)
    if pos then
    State.cursor1.pos = pos
    [4.800]
    [4.50892]
    local curr_pos = State.cursor1.pos
    local curr_line = State.lines[State.cursor1.line].data
    local curr_offset = Text.offset(curr_line, curr_pos)
    local offset = rfind(curr_line, State.search_term, curr_offset-1, --[[literal]] true)
    if offset then
    State.cursor1.pos = utf8.len(curr_line, 1, offset)
  • replacement in search.lua at line 81
    [4.50898][4.50898:50919]()
    if pos == nil then
    [4.50898]
    [4.801]
    if offset == nil then
  • replacement in search.lua at line 84
    [4.1238][2.564:662](),[2.662][4.50998:51016](),[4.1296][4.50998:51016](),[4.83607][4.50998:51016](),[4.50998][4.50998:51016](),[4.51016][4.177775:177817]()
    pos = rfind(State.lines[i].data, State.search_term, --[[from end]] nil, --[[literal]] true)
    if pos then
    State.cursor1 = {line=i, pos=pos}
    [4.1238]
    [4.51067]
    local curr_line = State.lines[i].data
    offset = rfind(curr_line, State.search_term, --[[from end]] nil, --[[literal]] true)
    if offset then
    State.cursor1 = {line=i, pos=utf8.len(curr_line, 1, offset)}
  • replacement in search.lua at line 92
    [4.51105][4.51105:51126]()
    if pos == nil then
    [4.51105]
    [4.51126]
    if offset == nil then
  • replacement in search.lua at line 95
    [4.1411][2.663:761](),[2.761][4.51229:51247](),[4.1469][4.51229:51247](),[4.83822][4.51229:51247](),[4.51229][4.51229:51247](),[4.51247][4.177818:177860]()
    pos = rfind(State.lines[i].data, State.search_term, --[[from end]] nil, --[[literal]] true)
    if pos then
    State.cursor1 = {line=i, pos=pos}
    [4.1411]
    [4.51298]
    local curr_line = State.lines[i].data
    offset = rfind(curr_line, State.search_term, --[[from end]] nil, --[[literal]] true)
    if offset then
    State.cursor1 = {line=i, pos=utf8.len(curr_line, 1, offset)}
  • replacement in search.lua at line 103
    [4.849][4.849:870]()
    if pos == nil then
    [4.849]
    [4.870]
    if offset == nil then
  • replacement in search.lua at line 105
    [4.910][2.762:875]()
    pos = rfind(State.lines[State.cursor1.line].data, State.search_term, --[[from end]] nil, --[[literal]] true)
    [4.910]
    [4.983]
    local curr_line = State.lines[State.cursor1.line].data
    offset = rfind(curr_line, State.search_term, --[[from end]] nil, --[[literal]] true)
    local pos = utf8.len(curr_line, 1, offset)
  • replacement in search.lua at line 112
    [4.51336][4.51336:51357]()
    if pos == nil then
    [4.51336]
    [4.1534]
    if offset == nil then