about summary refs log tree commit diff stats
path: root/text_tests.lua
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2022-07-07 07:39:01 -0700
committerKartik K. Agaram <vc@akkartik.com>2022-07-07 07:39:01 -0700
commit6dfe954c02dccfc043178ec65eb4706cbbde0ce8 (patch)
tree6c71f0ea70393202921e6876a335b7c696938f12 /text_tests.lua
parentdff4587219221d00a15d8a6907583643d8127090 (diff)
downloadtext.love-6dfe954c02dccfc043178ec65eb4706cbbde0ce8.tar.gz
yet another bugfix in selection management
Thanks Leonard Schütz for the report!

Failing scenario:
  click to move cursor
  hit backspace

First backspace wasn't being doing anything earlier.
Diffstat (limited to 'text_tests.lua')
-rw-r--r--text_tests.lua19
1 files changed, 1 insertions, 18 deletions
diff --git a/text_tests.lua b/text_tests.lua
index 025c76b..06af7e8 100644
--- a/text_tests.lua
+++ b/text_tests.lua
@@ -76,6 +76,7 @@ function test_click_with_mouse()
   App.run_after_mouse_click(Margin_left+8,Margin_top+5, 1)
   -- cursor moves
   check_eq(Cursor1.line, 1, 'F - test_click_with_mouse/cursor')
+  check_nil(Selection1.line, 'F - test_click_with_mouse/selection is empty to avoid perturbing future edits')
 end
 
 function test_click_with_mouse_on_empty_line()
@@ -334,24 +335,6 @@ function test_cursor_movement_without_shift_resets_selection()
   check_eq(Lines[1].data, 'abc', 'F - test_cursor_movement_without_shift_resets_selection/data')
 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=75, height=80}
-  Lines = load_array{'abc'}
-  Margin_right = 0; Margin_width = Margin_left
-  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_deletes_selection()
   io.write('\ntest_edit_deletes_selection')
   -- display a line of text with some part selected