bugfix: up arrow when line above is a drawing
[?]
Feb 1, 2023, 6:39 AM
SWZAQHGRX3T5MZVM7YZ4EACZX5ON2NUZG5YXLWVEXLL3WZUZYAFQCDependencies
- [2]
ORRSP7FVdeduce test names on failures - [3]
Z5HLXU4Padd state arg to a few functions - [4]
ODLKHO7Bswitch to line index in a function - [5]
LF7BWEG4group all editor globals - [6]
OI4FPFINsupport drawings in the source editor - [7]
SVJZZDC3snapshot - no, that's all wrong - [8]
KKMFQDR4editing source code from within the app - [9]
ZPUQSPQPextract a few methods - [10]
V5MJRFOZbugfix: down arrow doesn't scroll up unnecessarily - [*]
LXTTOB33extract a couple of files - [*]
BULPIBEGbeginnings of a module for the text editor
Change contents
- edit in text_tests.lua at line 1056
endfunction test_down_arrow_skips_drawing()-- some lines of text with a drawing intermixedlocal drawing_width = 50App.screen.init{width=Editor_state.left+drawing_width, height=100}Editor_state = edit.initialize_test_state()Editor_state.lines = load_array{'abc', -- height 15'```lines', '```', -- height 25'ghi'}Text.redraw_all(Editor_state)Editor_state.cursor1 = {line=1, pos=1}Editor_state.screen_top1 = {line=1, pos=1}Editor_state.screen_bottom1 = {}edit.draw(Editor_state)local y = Editor_state.topApp.screen.check(y, 'abc', 'baseline/screen:1')y = y + Editor_state.line_heightlocal drawing_height = Drawing_padding_height + drawing_width/2 -- defaulty = y + drawing_heightApp.screen.check(y, 'ghi', 'baseline/screen:3')check(Editor_state.cursor_x, 'baseline/cursor_x')-- after hitting the down arrow the cursor moves down by 2 lines, skipping the drawingedit.run_after_keychord(Editor_state, 'down')check_eq(Editor_state.cursor1.line, 3, 'cursor') - edit in text_tests.lua at line 1231
function test_up_arrow_skips_drawing()-- some lines of text with a drawing intermixedlocal drawing_width = 50App.screen.init{width=Editor_state.left+drawing_width, height=100}Editor_state = edit.initialize_test_state()Editor_state.lines = load_array{'abc', -- height 15'```lines', '```', -- height 25'ghi'}Text.redraw_all(Editor_state)Editor_state.cursor1 = {line=3, pos=1}Editor_state.screen_top1 = {line=1, pos=1}Editor_state.screen_bottom1 = {}edit.draw(Editor_state)local y = Editor_state.topApp.screen.check(y, 'abc', 'baseline/screen:1')y = y + Editor_state.line_heightlocal drawing_height = Drawing_padding_height + drawing_width/2 -- defaulty = y + drawing_heightApp.screen.check(y, 'ghi', 'baseline/screen:3')check(Editor_state.cursor_x, 'baseline/cursor_x')-- after hitting the up arrow the cursor moves up by 2 lines, skipping the drawingedit.run_after_keychord(Editor_state, 'up')check_eq(Editor_state.cursor1.line, 1, 'cursor')end - replacement in text.lua at line 429
State.cursor1 = {line=State.cursor1.line-1, pos=nil}State.cursor1 = {line=new_cursor_line, pos=nil} - edit in source_text_tests.lua at line 1026
endfunction test_down_arrow_skips_drawing()-- some lines of text with a drawing intermixedlocal drawing_width = 50App.screen.init{width=Editor_state.left+drawing_width, height=100}Editor_state = edit.initialize_test_state()Editor_state.lines = load_array{'abc', -- height 15'```lines', '```', -- height 25'ghi'}Text.redraw_all(Editor_state)Editor_state.cursor1 = {line=1, pos=1}Editor_state.screen_top1 = {line=1, pos=1}Editor_state.screen_bottom1 = {}edit.draw(Editor_state)local y = Editor_state.topApp.screen.check(y, 'abc', 'baseline/screen:1')y = y + Editor_state.line_heightlocal drawing_height = Drawing_padding_height + drawing_width/2 -- defaulty = y + drawing_heightApp.screen.check(y, 'ghi', 'baseline/screen:3')check(Editor_state.cursor_x, 'baseline/cursor_x')-- after hitting the down arrow the cursor moves down by 2 lines, skipping the drawingedit.run_after_keychord(Editor_state, 'down')check_eq(Editor_state.cursor1.line, 3, 'cursor') - edit in source_text_tests.lua at line 1201
function test_up_arrow_skips_drawing()-- some lines of text with a drawing intermixedlocal drawing_width = 50App.screen.init{width=Editor_state.left+drawing_width, height=100}Editor_state = edit.initialize_test_state()Editor_state.lines = load_array{'abc', -- height 15'```lines', '```', -- height 25'ghi'}Text.redraw_all(Editor_state)Editor_state.cursor1 = {line=3, pos=1}Editor_state.screen_top1 = {line=1, pos=1}Editor_state.screen_bottom1 = {}edit.draw(Editor_state)local y = Editor_state.topApp.screen.check(y, 'abc', 'baseline/screen:1')y = y + Editor_state.line_heightlocal drawing_height = Drawing_padding_height + drawing_width/2 -- defaulty = y + drawing_heightApp.screen.check(y, 'ghi', 'baseline/screen:3')check(Editor_state.cursor_x, 'baseline/cursor_x')-- after hitting the up arrow the cursor moves up by 2 lines, skipping the drawingedit.run_after_keychord(Editor_state, 'up')check_eq(Editor_state.cursor1.line, 1, 'cursor')end - replacement in source_text.lua at line 683
State.cursor1 = {line=State.cursor1.line-1, pos=nil}State.cursor1 = {line=new_cursor_line, pos=nil} - replacement in source_text.lua at line 722
State.cursor1 = {line=State.cursor1.line-1, posB=nil}State.cursor1 = {line=new_cursor_line, posB=nil}