PR4KIAZDOBQMEUOV2G7ZEZUW3E4L5ZCHYSS7PTYWGXPSNVRAGHCAC
537TQ2QNPKPG322I4OIMN5IY22S45Z42LEBBZ2IN5MVM355BEJTAC
HBZ2UCUFM6EYLFZGUQVJDCLANO4UXYMBOU3TFPB2JASJMB53ZGXAC
WLHI7KD3LJTQH6V7RLVJWGZUR4YQK6LN4OIUMIN45BGMMQGN6RNQC
BULPIBEGL7TMK6CVIE7IS7WGAHGOSUJBGJSFQK542MOWGHP2ADQQC
XNFTJHC4QSHNSIWNN7K6QZEZ37GTQYKHS4EPNSVPQCUSWREROGIQC
5ED3YGHW6H7XIXPMHRI5ZJ3VA5UCANZF4AJRSE6V7BLUF67Q6NAAC
76AIXR7HAUL74GYPPFH3N5N4VJWZL67WM4XTKWGSA6ESLIJZPB6QC
DLQMM2656JHXX3ONOEM6UIOXKFJFT5QT7RHWK7YS2W77PVZWHRSAC
SVJZZDC3K6AKAXHGRNAZKRE2ZXEKJANNLG7LSSUZJARFBL5F7C4AC
HYEAFRZ2UEKDYTAE2GDQLHEJBPQASP2NDLMXB7F6MTVK2BKOXKEAC
242L3OQXTU2TCAINRJXQEEDSXQXM7Y7USUPBK37ZNM3A7V5TUDSAC
-- next text line
local new_cursor_line = Cursor_line
while new_cursor_line < #Lines do
new_cursor_line = new_cursor_line+1
if Lines[new_cursor_line].mode == 'text' then
Cursor_line = new_cursor_line
Cursor_pos = Text.nearest_cursor_pos(Lines[Cursor_line].data, Cursor_x)
break
if Text.cursor_at_final_screen_line() then
-- line is done, skip to next text line
print('down: cursor at final screen line of its line')
local new_cursor_line = Cursor_line
while new_cursor_line < #Lines do
new_cursor_line = new_cursor_line+1
if Lines[new_cursor_line].mode == 'text' then
Cursor_line = new_cursor_line
Cursor_pos = Text.nearest_cursor_pos(Lines[Cursor_line].data, Cursor_x)
print(Cursor_pos)
break
end
end
if Cursor_line > Screen_bottom_line then
Screen_top_line = Cursor_line
Text.scroll_up_while_cursor_on_screen()
end
if Cursor_line > Screen_bottom_line then
Screen_top_line = Cursor_line
else
-- move down one screen line in current line
print('cursor is NOT at final screen line of its line')
local screen_line_index, screen_line_starting_pos = Text.pos_at_start_of_cursor_screen_line()
new_screen_line_starting_pos = Lines[Cursor_line].screen_line_starting_pos[screen_line_index+1]
print('switching pos of screen line at cursor from '..tostring(screen_line_starting_pos)..' to '..tostring(new_screen_line_starting_pos))
local s = string.sub(Lines[Cursor_line].data, new_screen_line_starting_pos)
Cursor_pos = new_screen_line_starting_pos + Text.nearest_cursor_pos(s, Cursor_x) - 1
print('cursor pos is now '..tostring(Cursor_pos))
Text.scroll_up_while_cursor_on_screen()