I had this idea originally to keep text.lua oblivious to drawings. But that hasn't been true for some time. Losing battle.
AMSESRTH4T7EIEMXEFPMZFC55QAOVSWAN2XOQUUEB5ECHRDZUAYQC
4RUI5X52CSQODLT3WI4VBMXWZLACBYV5QANGDKRWS3VONZPVSEEQC
LERERVPHE5SEWDHQ7IAGQSXUAI2QHQJ33NBNRMRXZ34X7P23I2IAC
ZPUQSPQPQFVRUIHGLAWW3IDBYODIWDHO62HAC3WWF5TM3CIJGHNQC
BULPIBEGL7TMK6CVIE7IS7WGAHGOSUJBGJSFQK542MOWGHP2ADQQC
BYG5CEMVXANDTBI2ORNVMEY6K3EBRIHZHS4QBK27VONJC5537COQC
DLQMM2656JHXX3ONOEM6UIOXKFJFT5QT7RHWK7YS2W77PVZWHRSAC
OTIBCAUJ3KDQJLVDN3A536DLZGNRYMGJLORZVR3WLCGXGO6UGO6AC
YTSPVDZHEN5LLNMGIBUBLPWFWSFM3SOHBRGWYSDEVFKRTH24ARRQC
2RXZ3PGOTTZ6M4R372JXIKPLBQKPVBMAXNPIEO2HZDN4EMYW4GNAC
CVGE3SIGJRGCLY3A2RBPGFXAEKVZXUUIZQLRHJLM4VPUM4SHEZIAC
U7M4M2F7P5TGLTHKQ7J72GQFNPBII4PLJVJ44YVVOYEI4KPUDI6AC
MDXGMZU2MBEDMTB755D3RRYEFKF54GTTYTI5XJYKKKN5ZFQWZXTAC
KJKKASHZCC5JD6G6PWQ4TA42NVI2CNTAZ667GA76H272DD6KCNRQC
242L3OQXTU2TCAINRJXQEEDSXQXM7Y7USUPBK37ZNM3A7V5TUDSAC
252M2QMDBMNWHBZY5MDSC7WVYO5JBLJYPVMW5W4IVJCZVYRQ5IQQC
elseif chord == 'pageup' then
-- duplicate some logic from love.draw
local top2 = Text.to2(Screen_top1)
--? print(App.screen.height)
local y = App.screen.height - math.floor(15*Zoom)
while y >= 15 do
--? print(y, top2.line)
if Screen_top1.line == 1 and Screen_top1.pos == 1 then break end
if Lines[Screen_top1.line].mode == 'text' then
y = y - math.floor(15*Zoom)
elseif Lines[Screen_top1.line].mode == 'drawing' then
y = y - 20 - Drawing.pixels(Lines[Screen_top1.line].h)
end
top2 = Text.previous_screen_line(top2)
end
Screen_top1 = Text.to1(top2)
Cursor1.line = Screen_top1.line
Cursor1.pos = Screen_top1.pos
Text.move_cursor_down_to_next_text_line_while_scrolling_again_if_necessary()
--? print(Cursor1.line, Cursor1.pos, Screen_top1.line, Screen_top1.pos)
elseif chord == 'pagedown' then
Screen_top1.line = Screen_bottom1.line
Screen_top1.pos = Screen_bottom1.pos
--? print('setting top to', Screen_top1.line, Screen_top1.pos)
Cursor1.line = Screen_top1.line
Cursor1.pos = Screen_top1.pos
Text.move_cursor_down_to_next_text_line_while_scrolling_again_if_necessary()
--? print('top now', Screen_top1.line)
elseif chord == 'pagedown' then
Screen_top1.line = Screen_bottom1.line
Screen_top1.pos = Screen_bottom1.pos
--? print('setting top to', Screen_top1.line, Screen_top1.pos)
Cursor1.line = Screen_top1.line
Cursor1.pos = Screen_top1.pos
Text.move_cursor_down_to_next_text_line_while_scrolling_again_if_necessary()
--? print('top now', Screen_top1.line)
elseif chord == 'pageup' then
-- duplicate some logic from love.draw
local top2 = Text.to2(Screen_top1)
--? print(App.screen.height)
local y = App.screen.height - math.floor(15*Zoom)
while y >= 15 do
--? print(y, top2.line)
if Screen_top1.line == 1 and Screen_top1.pos == 1 then break end
if Lines[Screen_top1.line].mode == 'text' then
y = y - math.floor(15*Zoom)
elseif Lines[Screen_top1.line].mode == 'drawing' then
y = y - 20 - Drawing.pixels(Lines[Screen_top1.line].h)
end
top2 = Text.previous_screen_line(top2)
end
Screen_top1 = Text.to1(top2)
Cursor1.line = Screen_top1.line
Cursor1.pos = Screen_top1.pos
Text.move_cursor_down_to_next_text_line_while_scrolling_again_if_necessary()
--? print(Cursor1.line, Cursor1.pos, Screen_top1.line, Screen_top1.pos)