bugfix: ensure Cursor_line is always on a text line
[?]
May 19, 2022, 1:19 AM
242L3OQXTU2TCAINRJXQEEDSXQXM7Y7USUPBK37ZNM3A7V5TUDSACDependencies
- [2]
A2TQYJ6J. - [3]
DLQMM265scroll past first page - [4]
252M2QMDforgot to move this special case out - [*]
BULPIBEGbeginnings of a module for the text editor - [*]
HYEAFRZ2split mouse_pressed events between Text and Drawing - [*]
OTIBCAUJlove2d scaffold - [*]
XNFTJHC4split keyboard handling between Text and Drawing - [*]
FS2ITYYHrecord a known issue
Change contents
- edit in text.lua at line 158
function Text.move_cursor_down_to_next_text_line_while_scrolling_again_if_necessary()while Cursor_line <= #Lines doif Lines[Cursor_line].mode == 'text' thenbreakendCursor_line = Cursor_line + 1end-- hack: insert a text line at bottom of file if necessaryif Cursor_line > #Lines thenassert(Cursor_line == #Lines+1)table.insert(Lines, {mode='text', data=''})endif Cursor_line > Screen_bottom_line thenScreen_top_line = Cursor_lineText.scroll_up_while_cursor_on_screen()endendfunction Text.scroll_up_while_cursor_on_screen()local y = Screen_height - 15*Zoom -- for Cursor_linewhile true doif Screen_top_line == 1 then break endy = y - 15*Zoomif Lines[Screen_top_line].mode == 'drawing' theny = y - Drawing.pixels(Lines[Screen_top_line].h)endif y < 15*Zoom thenbreakendScreen_top_line = Screen_top_line - 1endend - edit in main.lua at line 175
Text.move_cursor_down_to_next_text_line_while_scrolling_again_if_necessary() - replacement in main.lua at line 181
if Lines[Screen_top_line].mode == 'text' theny = y - 15*Zoomelsey = y - 15*Zoomif Lines[Screen_top_line].mode == 'drawing' then - edit in main.lua at line 191
Text.move_cursor_down_to_next_text_line_while_scrolling_again_if_necessary() - edit in README.md at line 6[2.148]
* The text cursor will always stay on the screen. This can have some strangeimplications:* A long series of drawings will get silently skipped when you hitpage-down, until a line of text can be showed on screen.* If there's no line of text at the bottom of the file, one will becreated.So far this app isn't really designed for all-drawing files. I'm really justtargeting mostly-text files with a few drawings mixed in.