Before this change the cursor was moving, but not being highlighted properly when the cursor line contained unicode before the cursor.
2H76FV5SK3ZWFVQ6ISAOSUJQWW4SSNPRDEI75JIQAJRPIVWPOCDAC
QSKWIEU3LOYO4NFUNMMUHH4S5QCQ7FAIBZGXZUOTWWTRNVTMOOOAC
ORRSP7FVCHI2TF5GXBRGQYYJAA3JFYXZBM3T663BKSBV22FCZVCAC
FZBXBUFFNRE5ZJO5DLRU375HOXT2B7FO35XD7BTHHUXSARVWDFLQC
EETIR4GXZBA5DEXUQKI6XMC22SFHZIYTZRR4U6BW6BT3RZA32FHQC
LXTTOB33N2HCUZFIUDRQGGBVHK2HODRG4NBLH6RXRQZDCHF27BSAC
LLAOOMULEBXFMIGRBY6LRVEK4RXQGPNTFVWMCZNUEJZHWC7UGUEAC
MSOQI3A5BC5PY2MZXZQAQ4EQDT4KICQJPN3YUZVDYTWXSPZWBLIAC
AMOPICKVRHMQERJLFPMAAEBV7TL5QACGGSBJWRCMV5R5O3KDVETAC
KKMFQDR43ZWVCDRHQLWWX3FCWCFA3ZSXYOBRJNPHUQZR2XPKWULAC
OI4FPFINEROK6GNDEMOBTGSPYIULCLRGGT5W3H7VLM7VFH22GMWQC
7PZ4CQFVYUMSJKVCNM75VKK5JCUYU6ICHWPZXXIC3S63YJVFCP5QC
5ZA3BRNYWKSGEBJ4JLA4UBC3LJPT5JBWYCU7PQYRSGX6MJMEWDIQC
LF7BWEG4DKQI7NMXMZC4LC2BE5PB42HK5PD6OYBNIDMAZBJASOKQC
Editor_state.lines = load_array{'```lines', '```', 'def', 'ghi', 'deg'}
Editor_state.lines = load_array{'```lines', '```', 'def', 'ghi', '’deg'} -- contains unicode quote in final line
local pos = find(State.lines[State.cursor1.line].data, State.search_term, State.cursor1.pos, --[[literal]] true)
if pos then
State.cursor1.pos = pos
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)
pos = find(State.lines[i].data, State.search_term, --[[from start]] nil, --[[literal]] true)
if pos then
State.cursor1 = {line=i, pos=pos}
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)}
pos = find(State.lines[i].data, State.search_term, --[[from start]] nil, --[[literal]] true)
if pos then
State.cursor1 = {line=i, pos=pos}
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)}
pos = find(State.lines[State.cursor1.line].data, State.search_term, --[[from start]] nil, --[[literal]] true)
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)
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
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)
pos = rfind(State.lines[i].data, State.search_term, --[[from end]] nil, --[[literal]] true)
if pos then
State.cursor1 = {line=i, pos=pos}
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)}
pos = rfind(State.lines[i].data, State.search_term, --[[from end]] nil, --[[literal]] true)
if pos then
State.cursor1 = {line=i, pos=pos}
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)}
pos = rfind(State.lines[State.cursor1.line].data, State.search_term, --[[from end]] nil, --[[literal]] true)
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)