scroll on enter
[?]
May 28, 2022, 3:38 PM
PHFWIFYKFOGVX7CEAMGJ3FDY6LL5QSZ7T7CTCZ66WMNXV6C242FACDependencies
- [2]
4RUI5X52a few tests for pageup, and a bugfix - [*]
BULPIBEGbeginnings of a module for the text editor - [*]
2ZYV7D3Whandle tab characters
Change contents
- edit in text.lua at line 658
endfunction test_enter_on_bottom_line_scrolls_down()io.write('\ntest_enter_on_bottom_line_scrolls_down')-- display a few lines with cursor on bottom lineApp.screen.init{width=25+30, height=60}Lines = load_array{'abc', 'def', 'ghi', 'jkl'}Line_width = App.screen.widthCursor1 = {line=3, pos=2}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_enter_on_bottom_line_scrolls_down/baseline/screen:1')y = y + line_heightApp.screen.check(y, 'def', 'F - test_enter_on_bottom_line_scrolls_down/baseline/screen:2')y = y + line_heightApp.screen.check(y, 'ghi', 'F - test_enter_on_bottom_line_scrolls_down/baseline/screen:3')-- after hitting the enter key the screen scrolls downApp.run_after_keychord('return')check_eq(Screen_top1.line, 2, 'F - test_enter_on_bottom_line_scrolls_down/screen_top')check_eq(Cursor1.line, 4, 'F - test_enter_on_bottom_line_scrolls_down/cursor:line')check_eq(Cursor1.pos, 1, 'F - test_enter_on_bottom_line_scrolls_down/cursor:pos')y = screen_top_marginApp.screen.check(y, 'def', 'F - test_enter_on_bottom_line_scrolls_down/screen:1')y = y + line_heightApp.screen.check(y, 'g', 'F - test_enter_on_bottom_line_scrolls_down/screen:2')y = y + line_heightApp.screen.check(y, 'hi', 'F - test_enter_on_bottom_line_scrolls_down/screen:3') - edit in text.lua at line 802[5.134][5.134]
if Cursor1.line > Screen_bottom1.line thenScreen_top1.line = Cursor1.lineText.scroll_up_while_cursor_on_screen()end