extract a couple more methods
This commit is contained in:
parent
86532eef4b
commit
d58aabe867
12
text.lua
12
text.lua
|
@ -993,6 +993,13 @@ function Text.keychord_pressed(chord)
|
||||||
elseif chord == 'down' then
|
elseif chord == 'down' then
|
||||||
Text.down()
|
Text.down()
|
||||||
elseif chord == 'pageup' then
|
elseif chord == 'pageup' then
|
||||||
|
Text.pageup()
|
||||||
|
elseif chord == 'pagedown' then
|
||||||
|
Text.pagedown()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function Text.pageup()
|
||||||
-- duplicate some logic from love.draw
|
-- duplicate some logic from love.draw
|
||||||
local top2 = Text.to2(Screen_top1)
|
local top2 = Text.to2(Screen_top1)
|
||||||
--? print(App.screen.height)
|
--? print(App.screen.height)
|
||||||
|
@ -1012,7 +1019,9 @@ function Text.keychord_pressed(chord)
|
||||||
Cursor1.pos = Screen_top1.pos
|
Cursor1.pos = Screen_top1.pos
|
||||||
Text.move_cursor_down_to_next_text_line_while_scrolling_again_if_necessary()
|
Text.move_cursor_down_to_next_text_line_while_scrolling_again_if_necessary()
|
||||||
--? print(Cursor1.line, Cursor1.pos, Screen_top1.line, Screen_top1.pos)
|
--? print(Cursor1.line, Cursor1.pos, Screen_top1.line, Screen_top1.pos)
|
||||||
elseif chord == 'pagedown' then
|
end
|
||||||
|
|
||||||
|
function Text.pagedown()
|
||||||
Screen_top1.line = Screen_bottom1.line
|
Screen_top1.line = Screen_bottom1.line
|
||||||
Screen_top1.pos = Screen_bottom1.pos
|
Screen_top1.pos = Screen_bottom1.pos
|
||||||
--? print('setting top to', Screen_top1.line, Screen_top1.pos)
|
--? print('setting top to', Screen_top1.line, Screen_top1.pos)
|
||||||
|
@ -1020,7 +1029,6 @@ function Text.keychord_pressed(chord)
|
||||||
Cursor1.pos = Screen_top1.pos
|
Cursor1.pos = Screen_top1.pos
|
||||||
Text.move_cursor_down_to_next_text_line_while_scrolling_again_if_necessary()
|
Text.move_cursor_down_to_next_text_line_while_scrolling_again_if_necessary()
|
||||||
--? print('top now', Screen_top1.line)
|
--? print('top now', Screen_top1.line)
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function Text.up()
|
function Text.up()
|
||||||
|
|
Loading…
Reference in New Issue