diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2024-10-29 18:16:55 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2024-10-29 18:16:55 -0700 |
commit | 6f122e9865dba44f4f05821373c60b4adc5b74df (patch) | |
tree | bc02323b7e148f6ad73babcc76f73234a7f41f32 /source_text_tests.lua | |
parent | c82750f027fefaf7364d221613422e009b3bbc52 (diff) | |
parent | 7e5653c8d39f6cc9393ed2cefb55b3de9640d3d3 (diff) | |
download | view.love-6f122e9865dba44f4f05821373c60b4adc5b74df.tar.gz |
Merge text.love
Diffstat (limited to 'source_text_tests.lua')
-rw-r--r-- | source_text_tests.lua | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/source_text_tests.lua b/source_text_tests.lua index 11cc823..7ed4caa 100644 --- a/source_text_tests.lua +++ b/source_text_tests.lua @@ -2073,3 +2073,31 @@ function test_search_wrap_upwards() check_eq(Editor_state.cursor1.line, 1, '1/cursor:line') check_eq(Editor_state.cursor1.pos, 6, '1/cursor:pos') end + +function test_search_downwards_from_end_of_line() + App.screen.init{width=120, height=60} + Editor_state = edit.initialize_test_state() + Editor_state.lines = load_array{'abc', 'def', 'ghi'} + Text.redraw_all(Editor_state) + Editor_state.cursor1 = {line=1, pos=4} + Editor_state.screen_top1 = {line=1, pos=1} + edit.draw(Editor_state) + -- search for empty string + edit.run_after_keychord(Editor_state, 'C-f', 'f') + edit.run_after_keychord(Editor_state, 'down', 'down') + -- no crash +end + +function test_search_downwards_from_final_pos_of_line() + App.screen.init{width=120, height=60} + Editor_state = edit.initialize_test_state() + Editor_state.lines = load_array{'abc', 'def', 'ghi'} + Text.redraw_all(Editor_state) + Editor_state.cursor1 = {line=1, pos=3} + Editor_state.screen_top1 = {line=1, pos=1} + edit.draw(Editor_state) + -- search for empty string + edit.run_after_keychord(Editor_state, 'C-f', 'f') + edit.run_after_keychord(Editor_state, 'down', 'down') + -- no crash +end |