keep one screen line of overlap on pagedown
[?]
May 24, 2022, 5:31 AM
LERERVPHE5SEWDHQ7IAGQSXUAI2QHQJ33NBNRMRXZ34X7P23I2IACDependencies
- [2]
H22OAXWEcouple of TODOs - [3]
A2NV3WVOscrolling with up arrow - [4]
5L7K4GBDclicking to the right of a wrapped line - [5]
537TQ2QNsome more logging - [6]
2RXZ3PGObeginning of a new approach to scroll+wrap - [7]
CVGE3SIGI feel confident now that page-down is working. - [8]
ESETRNLBbugfix: printing the first part of a line at the bottom made it seem non-wrapping - [9]
MDXGMZU2disable all debug prints - [10]
JY4VK7L2rename - [11]
JRGTJ2IWquite the frustrating bugfix - [12]
H2DPLWMVsnapshot: wrapping long lines at word boundaries - [13]
BOFNXP5Gclicking now moves the cursor even on long, wrapped lines - [14]
MGT5FTJ3first stab at supporting wrapping in cursor up - [15]
WLHI7KD3new globals: draw partial screen line up top - [16]
U7M4M2F7bugfix: don't rely on Screen_bottom1 while scrolling - [17]
YTSPVDZHfirst successful pagedown test, first bug found by test - [18]
S5VCAFKYcouple of tests for cursor down - [19]
QYIFOHW3first test! - [20]
IMEJA43Lsnapshot - [*]
BULPIBEGbeginnings of a module for the text editor - [*]
OTIBCAUJlove2d scaffold
Change contents
- replacement in text.lua at line 22
line.screen_line_starting_pos = nil -- TODO: avoid recomputing on every repaintif line.screen_line_starting_pos == nil thenText.populate_screen_line_starting_pos(line_index)end - replacement in text.lua at line 31
--? print('('..s(x)..','..s(y)..') '..frag..'('..s(frag_width)..' vs '..s(line_width)..') '..s(line_index)..' vs '..s(Screen_top1.line)..'; '..s(pos)..' vs '..s(Screen_top1.pos))--? print('('..s(x)..','..s(y)..') '..frag..'('..s(frag_width)..' vs '..s(line_width)..') '..s(line_index)..' vs '..s(Screen_top1.line)..'; '..s(pos)..' vs '..s(Screen_top1.pos)..'; bottom: '..s(Screen_bottom1.line)..'/'..s(Screen_bottom1.pos)) - replacement in text.lua at line 37
--? print('text: new screen line', y, App.screen.height, screen_line_starting_pos)if y + math.floor(15*Zoom) > App.screen.height then--? print('b', y, App.screen.height, '=>', screen_line_starting_pos)return y, screen_line_starting_posend - edit in text.lua at line 42
--? print('text: new screen line', y, App.screen.height, screen_line_starting_pos) - edit in text.lua at line 46[4.2198]→[4.1:169](∅→∅),[4.169]→[4.105:115](∅→∅),[4.115]→[4.244:306](∅→∅),[4.306]→[3.273:379](∅→∅),[3.379]→[4.326:349](∅→∅),[4.326]→[4.326:349](∅→∅),[4.349]→[4.326:386](∅→∅),[4.326]→[4.326:386](∅→∅),[4.386]→[4.350:397](∅→∅),[4.170]→[4.241:298](∅→∅),[4.264]→[4.241:298](∅→∅),[4.397]→[4.241:298](∅→∅),[4.241]→[4.241:298](∅→∅),[4.298]→[4.169:179](∅→∅),[4.169]→[4.169:179](∅→∅)
if line.screen_line_starting_pos == nil thenline.screen_line_starting_pos = {1, pos}elsetable.insert(line.screen_line_starting_pos, pos)end-- if we updated y, check if we're done with the screenif line_index > Screen_top1.line or (line_index == Screen_top1.line and pos > Screen_top1.pos) then--? print('a')if y + math.floor(15*Zoom) > App.screen.height then--? print('b', y, App.screen.height)return y, screen_line_starting_posendend - replacement in text.lua at line 47
if Debug_new_render then print('checking to draw', pos, Screen_top1.pos) end--? print('checking to draw', pos, Screen_top1.pos) - edit in text.lua at line 144
local text height = 15 - edit in text.lua at line 159
function test_pagedown_shows_one_screen_line_in_common()io.write('\ntest_pagedown_shows_one_screen_line_in_common')-- some lines of text with a drawing intermixedApp.screen.init{width=50, height=60}Lines = load_array{'abc', 'def ghi jkl', 'mno'}Line_width = App.screen.widthCursor1 = {line=1, pos=1}Screen_top1 = {line=1, pos=1}Screen_bottom1 = {}Zoom = 1local screen_top_margin = 15 -- pixelslocal line_height = math.floor(15*Zoom) -- pixelsApp.draw()local y = screen_top_marginApp.screen.check(y, 'abc', 'F - test_pagedown_shows_one_screen_line_in_common/baseline/screen:1')y = y + line_heightApp.screen.check(y, 'def ', 'F - test_pagedown_shows_one_screen_line_in_common/baseline/screen:2')y = y + line_heightApp.screen.check(y, 'ghi ', 'F - test_pagedown_shows_one_screen_line_in_common/baseline/screen:3')-- after pagedown the bottom screen line becomes the topApp.run_after_keychord('pagedown')check_eq(Screen_top1.line, 2, 'F - test_pagedown_shows_one_screen_line_in_common/screen_top:line')check_eq(Screen_top1.pos, 5, 'F - test_pagedown_shows_one_screen_line_in_common/screen_top:pos')check_eq(Cursor1.line, 2, 'F - test_pagedown_shows_one_screen_line_in_common/cursor:line')check_eq(Cursor1.pos, 5, 'F - test_pagedown_shows_one_screen_line_in_common/cursor:pos')y = screen_top_marginApp.screen.check(y, 'ghi ', 'F - test_pagedown_shows_one_screen_line_in_common/screen:1')y = y + line_heightApp.screen.check(y, 'jkl', 'F - test_pagedown_shows_one_screen_line_in_common/screen:2')y = y + line_heightApp.screen.check(y, 'mn', 'F - test_pagedown_shows_one_screen_line_in_common/screen:3')end - replacement in main.lua at line 238
--? print('setting top to', Screen_top1.line)--? print('setting top to', Screen_top1.line, Screen_top1.pos)