I'd wrapped currx in two conditionals, and not noticed that it gets reclaimed within the other.
The hint is clearly more work than it's worth. Just take it out.
76AIXR7HAUL74GYPPFH3N5N4VJWZL67WM4XTKWGSA6ESLIJZPB6QC
DAENUOGV7KR6MZVXS36HEN3SZC4RFIS6REGAFVBOFEPO76EUDGIAC
XNFTJHC4QSHNSIWNN7K6QZEZ37GTQYKHS4EPNSVPQCUSWREROGIQC
BULPIBEGL7TMK6CVIE7IS7WGAHGOSUJBGJSFQK542MOWGHP2ADQQC
HYEAFRZ2UEKDYTAE2GDQLHEJBPQASP2NDLMXB7F6MTVK2BKOXKEAC
Cursor_pos = Text.nearest_cursor_pos(Lines[Cursor_line].data, old_x, Cursor_pos)
Cursor_pos = Text.nearest_cursor_pos(Lines[Cursor_line].data, old_x)
function Text.nearest_cursor_pos(line, x, hint)
function Text.nearest_cursor_pos(line, x)
if hint then local currx = Text.cursor_x(line, hint) if currx > x-2 and currx < x+2 then return hint end end
if hint then
local currx = Text.cursor_x(line, hint)
if currx > x-2 and currx < x+2 then
return hint
end
if hint then if currx > x then right = hint else left = hint end end
if currx > x then
right = hint
else
left = hint