more precise height calculation when scrolling up as much as possible while keeping cursor on screen
[?]
May 21, 2022, 5:43 AM
TRNWIQN6RPLDLYWULLKG5L255E7E3DPNGLCSLAF6IJWYQRCCLARQCDependencies
- [2]
2POFQQLWkeep cursor on screen when pressing 'down' - [3]
242L3OQXbugfix: ensure Cursor_line is always on a text line - [4]
HYEAFRZ2split mouse_pressed events between Text and Drawing - [5]
PR4KIAZDfirst stab at equally hacky cursor down support - [6]
DXT4QTAHa few more integer coordinates - [*]
BULPIBEGbeginnings of a module for the text editor - [*]
XNFTJHC4split keyboard handling between Text and Drawing - [*]
SVJZZDC3snapshot - no, that's all wrong
Change contents
- edit in text.lua at line 297
print('=>', Cursor_line, Cursor_pos, Screen_bottom_line) - edit in text.lua at line 308
print('scroll up preserving cursor') - edit in text.lua at line 310[3.1666][10.1313]
print('screen top after:', Screen_top_line, Top_screen_line_starting_pos) - replacement in text.lua at line 356
local y = Screen_height - math.floor(15*Zoom) -- for Cursor_linelocal cursor_pos_screen_lines = Text.pos_at_start_of_cursor_screen_line()print('cursor pos '..tostring(Cursor_pos)..' is on the #'..tostring(cursor_pos_screen_lines)..' screen line down')local y = Screen_height - cursor_pos_screen_lines*math.floor(15*Zoom)-- duplicate some logic from love.draw - replacement in text.lua at line 362
y = y - math.floor(15*Zoom)if Lines[Screen_top_line].mode == 'drawing' theny = y - Drawing.pixels(Lines[Screen_top_line].h)print('y', y)local h = 0if Lines[Screen_top_line-1].mode == 'drawing' thenh = 20 + Drawing.pixels(Lines[Screen_top_line-1].h)elseif Lines[Screen_top_line-1].screen_line_starting_pos == nil thenh = h + math.floor(15*Zoom) -- text heightelselocal n = #Lines[Screen_top_line-1].screen_line_starting_posh = h + n*math.floor(15*Zoom) -- text heightendprint('height:', h)if y - h < 0 thenbreak - edit in text.lua at line 376
y = y - h