about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2024-12-06 13:53:44 -0800
committerKartik K. Agaram <vc@akkartik.com>2024-12-06 13:53:44 -0800
commit40ac3dd75b43489f3796dce7679283d552347067 (patch)
treea2fa5e29fbd03e62a19248b81328dd348721a470
parente698a3a65dc6df83ab20a5b03d0a021eed87af3a (diff)
parent117c56a9bc2c73e1242732686e3e7d3d554ba3df (diff)
downloadtext.love-40ac3dd75b43489f3796dce7679283d552347067.tar.gz
Merge lines.love HEAD main
-rw-r--r--source_text_tests.lua7
-rw-r--r--text_tests2
-rw-r--r--text_tests.lua7
3 files changed, 9 insertions, 7 deletions
diff --git a/source_text_tests.lua b/source_text_tests.lua
index 7ed4caa..12fb9c6 100644
--- a/source_text_tests.lua
+++ b/source_text_tests.lua
@@ -319,7 +319,7 @@ function test_click_on_empty_line()
   check_nil(Editor_state.selection1.line, 'selection is empty to avoid perturbing future edits')
 end
 
-function test_click_below_all_lines()
+function test_click_below_final_line_of_file()
   -- display one line
   App.screen.init{width=50, height=80}
   Editor_state = edit.initialize_test_state()
@@ -331,8 +331,9 @@ function test_click_below_all_lines()
   -- click below first line
   edit.draw(Editor_state)
   edit.run_after_mouse_click(Editor_state, Editor_state.left+8,Editor_state.top+50, 1)
-  -- cursor doesn't move
-  check_eq(Editor_state.cursor1.line, 1, 'cursor')
+  -- cursor goes to bottom
+  check_eq(Editor_state.cursor1.line, 1, 'cursor:line')
+  check_eq(Editor_state.cursor1.pos, 4, 'cursor:pos')
   -- selection remains empty
   check_nil(Editor_state.selection1.line, 'selection is empty to avoid perturbing future edits')
 end
diff --git a/text_tests b/text_tests
index 2a31131..85d9de9 100644
--- a/text_tests
+++ b/text_tests
@@ -23,7 +23,7 @@ click on wrapping line rendered from partway at top of screen
 click past end of wrapping line
 click past end of wrapping line containing non ascii
 click past end of word wrapping line
-click below final line does nothing
+click below final line of file
 
 # cursor movement
 move left
diff --git a/text_tests.lua b/text_tests.lua
index 7bf2221..962de7d 100644
--- a/text_tests.lua
+++ b/text_tests.lua
@@ -293,7 +293,7 @@ function test_click_on_empty_line()
   check_nil(Editor_state.selection1.line, 'selection is empty to avoid perturbing future edits')
 end
 
-function test_click_below_all_lines()
+function test_click_below_final_line_of_file()
   -- display one line
   App.screen.init{width=50, height=80}
   Editor_state = edit.initialize_test_state()
@@ -305,8 +305,9 @@ function test_click_below_all_lines()
   -- click below first line
   edit.draw(Editor_state)
   edit.run_after_mouse_click(Editor_state, Editor_state.left+8,Editor_state.top+50, 1)
-  -- cursor doesn't move
-  check_eq(Editor_state.cursor1.line, 1, 'cursor')
+  -- cursor goes to bottom
+  check_eq(Editor_state.cursor1.line, 1, 'cursor:line')
+  check_eq(Editor_state.cursor1.pos, 4, 'cursor:pos')
   -- selection remains empty
   check_nil(Editor_state.selection1.line, 'selection is empty to avoid perturbing future edits')
 end