A lightweight programming environment for desktop and mobile devices

bugfix

manifestation: clicking past end of a long, wrapping line containing non-ASCII would cause the cursor to disappear rather than position past end of screen line. Hitting enter would then throw an assertion with the following stack trace:

Error: text.lua:381: bad argument #2 to 'sub' (number expected, got nil) stack traceback: [love "boot.lua"]:345: in function <[love "boot.lua"]:341> [C]: in function 'sub' text.lua:381: in function 'insert_return' text.lua:179: in function 'keychord_pressed' main.lua:495: in function 'keychord_pressed' keychord.lua:10: in function <keychord.lua:5> app.lua:34: in function <app.lua:25> [C]: in function 'xpcall'

cause: the click caused a call to Text.to_pos_on_line whose result was not on a UTF-8 character boundary.

fix: make to_pos_on_line utf8-aware.

Created by  Kartik K. Agaram  on June 13, 2022
4VKEE43Z7MUPNIAOCK36INVBNHRTSWRRN37TIKRPXPH3DRKGHHAQC
Change contents