I'm still trying to get those two tests to scroll and keep cursor on screen: typing in text at bottom screen line of screen until it wraps hitting down arrow from bottom screen line of screen (assuming pane extends further down)
But this small tweak to keychord_pressed_on_editable_pane isn't the answer. It ensures down arrow makes forward progress, but the first down arrow past bottom still makes the cursor invisible. Unclear why it gets into that state and how it's able to get out of that state now.
Things I remember now:
Another thing I've learned: the bug with down arrow is unrelated to wrapping lines. I can reproduce it in an editor containing all single-char lines.
It's almost like snap_cursor_to_bottom_of_screen isn't operating exactly opposite to draw in some situations. Assuming no line wrapping: screen_top = snap_cursor_to_bottom_of_screen(cursor) screen_bottom = edit.draw() assert(cursor.line == screen_bottom.line)
This is getting violated somehow?! Even if the screen height isn't an integral multiple of line_height, it seems like straightforward modulo arithmetic. If cursor is at bottom screen line and there's no wrapping: screen_top.line = cursor.line - math.floor(App.screen.height/line_height) screen_bottom.line = screen_top.line + math.floor(App.screen.height/line_height) assert(cursor.line == screen_bottom.line)
I'm still juggling tons of state in my head, feeling incredibly stupid.
QBL4YDQ5QC4MZ7RFS4ZSEBPN5WATAJ7UQLUPTXDUMXAMGBGQDOOQC Y2BSVYHAC36YUOITPSJVPTD34QVRTRHTWTTGFTGDPAACBLLHTT4AC JKAMPNVJHLSYZT5M7GKWGIHTJFIJU3VUJ2AWHLH3ORDUX3UTCF5QC Z5HLXU4PJWWJJDBCK52NBD6PIRIA3TAN2BKZB5HBYFGIDBX4F5HAC BULPIBEGL7TMK6CVIE7IS7WGAHGOSUJBGJSFQK542MOWGHP2ADQQC MXA3RZYKUI4UF2ISY7JEF6VKX6NOPZMZH5SLLCZHRJKFIXXXDPSAC ZPUQSPQPQFVRUIHGLAWW3IDBYODIWDHO62HAC3WWF5TM3CIJGHNQC LF7BWEG4DKQI7NMXMZC4LC2BE5PB42HK5PD6OYBNIDMAZBJASOKQC QCPXQ2E3USF3Z6R6WJ2JKHTRMPKA6QWXFKKRMLXA3MXABJEL543AC QCQTMUZ7M3BKJFTKXTTXL4TS4CAQNIUNK3LR3WQIJDU3VVTOPS6AC TGHAJBESCIEGWUE2D3FGLNOIAYT4D2IRGZKRXRMTUFW7QZETC7OAC ILOA5BYFTQKBSHLFMMZUVPQ2JXBFJD62ERQFBTDK2WSRXUN525VQC CUIV2LE5D6GUQ4NU7K2TGUVO5CTUXVJDRCZUIV47LXTOUSEPEJHQC HTWAM4NZFOY463TNSKYIM2EWB7QNBGDRRTTGHF5N3Z4TGC7Q3SFAC KOTI3MFGQ4PDS4I75JIJG734LTET6745VGTSMNFYYASVIO6H2KPAC 242L3OQXTU2TCAINRJXQEEDSXQXM7Y7USUPBK37ZNM3A7V5TUDSAC 3OKKTUT4Q7W44JHILOFV5BVUA7ZOBIHBCEXGZ65CPXV4PRLI2W4QC OSDKHQQ25NJUL2GIVB3LOAYTPA2QPQ6NXTZMW5DIX2LLRLYHD7HAC CZY3IDERLI6MTKKKMX6QLLERSPM2ZJ57NGQRKILJBM7S5PYPQ3XAC OTIBCAUJ3KDQJLVDN3A536DLZGNRYMGJLORZVR3WLCGXGO6UGO6AC MGH5UZL44BLWWF627W6FZPP5QBPDJ72QVB27GMSRTLTCXHBHPMUAC H5JVZ42KOC3QKTARTCJQUZP6473FCWTW72RKPORLARCRVBERBLKQC VSMPAAJDBVZXZIUFCXY53VM5F63B3ZOS63MCIHH43OA3SKVMJJ7AC 4A6GJRVUV7PVB62QCNDN7RN6NBHEDN6XPUFJXX22G2OCGNKLCTCAC V6AFS46Z3JN325KKEOZNUJJTCOZOKLWB5O5UUS323VOPGH6J4MXAC R2ZGBQPSLZMAUJLGUYYK77F3RSHOBFBK44IM4LZ4OPNBUOGO27DAC LNUHQOGHIOFGJXNGA3DZLYEASLYYDGLN2I3EDZY5ANASQAHCG3YQC 2L5MEZV344TOZLVY3432RHJFIRVXFD6O3GWLL5O4CV66BGAFTURQC X3F7ECSLGXCH6NBSDIH7LY47I4EG2RR5VFPEMM6ZVDYQIGFID4HQC --? print('down', State.cursor1.line, State.cursor1.pos, State.screen_top1.line, State.screen_top1.pos, State.screen_bottom1.line, State.screen_bottom1.pos)
print('down', State.cursor1.line, State.cursor1.pos, State.screen_top1.line, State.screen_top1.pos, State.screen_bottom1.line, State.screen_bottom1.pos)
--? print('screen top before:', State.screen_top1.line, State.screen_top1.pos)--? print('scroll up preserving cursor')
print('screen top before:', State.screen_top1.line, State.screen_top1.pos)print('scroll up preserving cursor')
--? print('switching pos of screen line at cursor from '..tostring(screen_line_starting_pos)..' to '..tostring(new_screen_line_starting_pos))
print('switching pos of screen line at cursor from '..tostring(screen_line_starting_pos)..' to '..tostring(new_screen_line_starting_pos))
--? print('=>', State.cursor1.line, State.cursor1.pos, State.screen_top1.line, State.screen_top1.pos, State.screen_bottom1.line, State.screen_bottom1.pos)
print('=>', State.cursor1.line, State.cursor1.pos, State.screen_top1.line, State.screen_top1.pos, State.screen_bottom1.line, State.screen_bottom1.pos)
if pane.cursor_y < Header_height or pane.cursor_y >= App.screen.height then
--? if pane.cursor_y + pane.line_height > App.screen.height then--? print('chord:', pane.cursor_y,'+',pane.line_height, '>', App.screen.height, 'stop')--? return--? endif pane.cursor_y < Header_height or pane.cursor_y > App.screen.height then
--? print('updating viewport based on screen top')--? print('from', Display_settings.y, pane.screen_top1.line, pane.screen_top1.pos, y_of_schema1(pane, pane.screen_top1))
print(('screen top changed from (%d,%d) to (%d,%d)'):format(old_top.line, old_top.pos, pane.screen_top1.line, pane.screen_top1.pos))print('updating viewport based on screen top')print('from', Display_settings.y, y_of_schema1(pane, pane.screen_top1))
--? print('draw:', y, line_index, line)-- I'd like to do the following, but that requires fixing up a bunch of tests.--? if y > App.screen.height then break endif y + State.line_height > App.screen.height then break end
--? if State.foo then--? print('draw:', line_index, y, '+', State.line_height, 'vs', App.screen.height)--? endif y + State.line_height > App.screen.height then--? print('draw:', line.data, '--', y,'+',State.line_height, '>', App.screen.height, 'stop')breakend