planning out cursor up/down over wrapped lines

This commit is contained in:
Kartik K. Agaram 2022-05-19 22:56:55 -07:00
parent a7c7fd6bce
commit d622043284
2 changed files with 5 additions and 3 deletions

View File

@ -7,7 +7,7 @@ Known issues:
implications:
* A long series of drawings will get silently skipped when you hit
page-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 be
created.
So far this app isn't really designed for all-drawing files. I'm really just
* If there's no line of text at the top of the file, you may not be able
to scroll back up to the top with page-up.
So far this app isn't really designed for drawing-heavy files. For now I'm
targeting mostly-text files with a few drawings mixed in.

View File

@ -213,6 +213,7 @@ function Text.keychord_pressed(chord)
save_to_disk(Lines, Filename)
elseif chord == 'up' then
assert(Lines[Cursor_line].mode == 'text')
-- previous text line
local new_cursor_line = Cursor_line
while new_cursor_line > 1 do
new_cursor_line = new_cursor_line-1
@ -228,6 +229,7 @@ function Text.keychord_pressed(chord)
end
elseif chord == 'down' then
assert(Lines[Cursor_line].mode == 'text')
-- next text line
local new_cursor_line = Cursor_line
while new_cursor_line < #Lines do
new_cursor_line = new_cursor_line+1