diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2022-08-10 22:38:10 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2022-08-10 22:38:10 -0700 |
commit | ba48aadaa71ac01db2a9d9bd06a26dec30fd31b3 (patch) | |
tree | a27028754c2590e43414266c12d1f5dd391ebc25 /text_tests.lua | |
parent | 8cfffdef41a56db0e2db7b329c5d0c31b2564e3c (diff) | |
download | text.love-ba48aadaa71ac01db2a9d9bd06a26dec30fd31b3.tar.gz |
bugfix: backspace from start of final line
Diffstat (limited to 'text_tests.lua')
-rw-r--r-- | text_tests.lua | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/text_tests.lua b/text_tests.lua index 91c5364..9983e2d 100644 --- a/text_tests.lua +++ b/text_tests.lua @@ -42,6 +42,22 @@ function test_backspace_to_delete_drawing() check_eq(Editor_state.cursor1.line, 1, 'F - test_backspace_to_delete_drawing/cursor') end +function test_backspace_from_start_of_final_line() + io.write('\ntest_backspace_from_start_of_final_line') + -- display final line of text with cursor at start of it + App.screen.init{width=120, height=60} + Editor_state = edit.initialize_test_state() + Editor_state.lines = load_array{'abc', 'def'} + Editor_state.screen_top1 = {line=2, pos=1} + Editor_state.cursor1 = {line=2, pos=1} + Text.redraw_all(Editor_state) + -- backspace scrolls up + edit.run_after_keychord(Editor_state, 'backspace') + check_eq(#Editor_state.lines, 1, 'F - test_backspace_from_start_of_final_line/#lines') + check_eq(Editor_state.cursor1.line, 1, 'F - test_backspace_from_start_of_final_line/cursor') + check_eq(Editor_state.screen_top1.line, 1, 'F - test_backspace_from_start_of_final_line/screen_top') +end + function test_insert_first_character() io.write('\ntest_insert_first_character') App.screen.init{width=120, height=60} |