diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2022-06-19 09:21:32 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2022-06-19 09:21:32 -0700 |
commit | 3ffc2ed8f32237969fb202f89200df01e7fbdbc8 (patch) | |
tree | af796fb781a10f436ac690fccef8f84fa72eae15 /text_tests.lua | |
parent | 703ed905c13a837c683aed0bf09bb68b0d7c9430 (diff) | |
download | view.love-3ffc2ed8f32237969fb202f89200df01e7fbdbc8.tar.gz |
bugfix
To reproduce: click to position cursor at end of a line hit enter press any key before: newline got erased and key got added to previous line now: newline is preserved The new test checks a generalization of this.
Diffstat (limited to 'text_tests.lua')
-rw-r--r-- | text_tests.lua | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/text_tests.lua b/text_tests.lua index 221d969..f835d8d 100644 --- a/text_tests.lua +++ b/text_tests.lua @@ -186,6 +186,24 @@ function test_click_on_wrapping_line_containing_non_ascii() check_eq(Cursor1.pos, 15, 'F - test_click_on_wrapping_line_containing_non_ascii/cursor') -- one more than the number of UTF-8 code-points end +function test_edit_after_click_resets_selection() + io.write('\ntest_edit_after_click_resets_selection') + -- display a line of text + App.screen.init{width=80, height=80} + Lines = load_array{'abc'} + Line_width = 75 + Cursor1 = {line=1, pos=1} + Screen_top1 = {line=1, pos=1} + Screen_bottom1 = {} + App.draw() + -- click past the end of it and hit enter + App.run_after_mouse_click(Margin_left+40,Margin_top+5, 1) + check(Selection1.line, 'F - test_edit_after_click_resets_selection/baseline') + App.run_after_keychord('return') + -- selection is reset since shift key is not pressed + check_nil(Selection1.line, 'F - test_edit_after_click_resets_selection') +end + function test_edit_wrapping_text() io.write('\ntest_edit_wrapping_text') App.screen.init{width=50, height=60} |