diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2022-05-18 17:22:04 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2022-05-18 17:42:08 -0700 |
commit | f91e5201241451fe5f9712a97c288f1534e74b11 (patch) | |
tree | e5d6618d03e6a49bfbd120a536b4aba6dc7361cc /text.lua | |
parent | e27165cb9f0f0635f0290cb345442292faeba7fd (diff) | |
download | text.love-f91e5201241451fe5f9712a97c288f1534e74b11.tar.gz |
scroll past first page
Still some limitations. The text cursor has to be visible on screen, so if you have a long series of drawings without intervening lines of text you won't be able to scroll through them all.
Diffstat (limited to 'text.lua')
-rw-r--r-- | text.lua | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/text.lua b/text.lua index 6888fda..f7ffb63 100644 --- a/text.lua +++ b/text.lua @@ -50,6 +50,9 @@ function Text.keychord_pressed(chord) break end end + if Cursor_line < Screen_top_line then + Screen_top_line = Cursor_line + end end elseif chord == 'right' then assert(Lines[Cursor_line].mode == 'text') @@ -65,6 +68,9 @@ function Text.keychord_pressed(chord) break end end + if Cursor_line > Screen_bottom_line then + Screen_top_line = Cursor_line + end end elseif chord == 'home' then Cursor_pos = 1 @@ -128,6 +134,9 @@ function Text.keychord_pressed(chord) break end end + if Cursor_line < Screen_top_line then + Screen_top_line = Cursor_line + end elseif chord == 'down' then assert(Lines[Cursor_line].mode == 'text') local new_cursor_line = Cursor_line @@ -140,10 +149,14 @@ function Text.keychord_pressed(chord) break end end + if Cursor_line > Screen_bottom_line then + Screen_top_line = Cursor_line + end end end function Text.in_line(line, x,y) + if line.y == nil then return false end -- outside current page return x >= 16 and y >= line.y and y < line.y+15*Zoom end |