The culprit is an ambiguously named helper. put_cursor_on_next_text_line is not supposed to move to next line if the current line is text.
ZLWFFQHIJHV4TE3JA27NK3CBNOMQU3UMMN6HVNQN7L2NMJMI43SAC if State.lines[line].mode == 'text' thenState.cursor1.line = lineState.cursor1.pos = 1breakend
endif line <= #State.lines and State.lines[line].mode == 'text' thenState.cursor1.line = lineState.cursor1.pos = 1
if State.lines[line].mode == 'text' thenState.cursor1.line = lineState.cursor1.pos = 1breakend
endif line <= #State.lines and State.lines[line].mode == 'text' thenState.cursor1.line = lineState.cursor1.pos = 1