I spent 20 minutes converting a manual test to a reproducible automated one, but in the process I knew exactly what the problem was. Nice.
WY3JD6W6EANKQC4SRRIAM2Q3QZNVOGN3MIMBL3M55S4ZZSJFSF2AC function test_position_cursor_on_recently_edited_wrapping_line()-- draw a line wrapping over 2 screen linesio.write('\ntest_position_cursor_on_recently_edited_wrapping_line')App.screen.init{width=120, height=200}Lines = load_array{'abc def ghi jkl mno pqr ', 'xyz'}Line_width = 100Cursor1 = {line=1, pos=25}Screen_top1 = {line=1, pos=1}Screen_bottom1 = {}Zoom = 1App.draw()local screen_top_margin = 15 -- pixelslocal line_height = 15 -- pixelslocal y = screen_top_margin-- I don't understand why 120px fits so much on a fake screen, but whatever..App.screen.check(y, 'abc def ghi ', 'F - test_position_cursor_on_recently_edited_wrapping_line/baseline1/screen:1')y = y + line_heightApp.screen.check(y, 'jkl mno pqr ', 'F - test_position_cursor_on_recently_edited_wrapping_line/baseline1/screen:2')y = y + line_heightApp.screen.check(y, 'xyz', 'F - test_position_cursor_on_recently_edited_wrapping_line/baseline1/screen:3')-- add to the line until it's wrapping over 3 screen linesApp.run_after_textinput('s')App.run_after_textinput('t')App.run_after_textinput('u')check_eq(Cursor1.pos, 28, 'F - test_move_cursor_using_mouse/cursor:pos')y = screen_top_marginApp.screen.check(y, 'abc def ghi ', 'F - test_position_cursor_on_recently_edited_wrapping_line/baseline2/screen:1')y = y + line_heightApp.screen.check(y, 'jkl mno pqr ', 'F - test_position_cursor_on_recently_edited_wrapping_line/baseline2/screen:2')y = y + line_heightApp.screen.check(y, 'stu', 'F - test_position_cursor_on_recently_edited_wrapping_line/baseline2/screen:3')-- try to move the cursor earlier in the third screen line by clicking the mouselocal screen_top_margin = 15 -- pixelslocal screen_left_margin = 25 -- pixelsApp.run_after_mousepress(screen_left_margin+8,screen_top_margin+15*2+5, '1')-- cursor should movecheck_eq(Cursor1.line, 1, 'F - test_move_cursor_using_mouse/cursor:line')check_eq(Cursor1.pos, 26, 'F - test_move_cursor_using_mouse/cursor:pos')end