about summary refs log tree commit diff stats
path: root/text.lua
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2022-06-03 08:11:18 -0700
committerKartik K. Agaram <vc@akkartik.com>2022-06-03 08:11:18 -0700
commit73cc12047e7eb8162c1f1a2f19be77bb821be85a (patch)
tree9e48f4e7cb46ae1877b2725d8276ddc5a2f277fb /text.lua
parent9efeae1f82738ecab185dae2d16a5e4c13f91aa0 (diff)
downloadtext.love-73cc12047e7eb8162c1f1a2f19be77bb821be85a.tar.gz
select text using mouse drag
Doesn't yet highlight while dragging.
Diffstat (limited to 'text.lua')
-rw-r--r--text.lua8
1 files changed, 6 insertions, 2 deletions
diff --git a/text.lua b/text.lua
index 3c3bb9d..a2e22ab 100644
--- a/text.lua
+++ b/text.lua
@@ -499,7 +499,7 @@ function test_move_cursor_using_mouse()
   Screen_bottom1 = {}
   App.draw()  -- populate line.y for each line in Lines
   local screen_left_margin = 25  -- pixels
-  App.run_after_mousepress(screen_left_margin+8,Margin_top+5, '1')
+  App.run_after_mouserelease(screen_left_margin+8,Margin_top+5, '1')
   check_eq(Cursor1.line, 1, 'F - test_move_cursor_using_mouse/cursor:line')
   check_eq(Cursor1.pos, 2, 'F - test_move_cursor_using_mouse/cursor:pos')
 end
@@ -1039,7 +1039,7 @@ function test_position_cursor_on_recently_edited_wrapping_line()
   App.screen.check(y, 'stu', 'F - test_position_cursor_on_recently_edited_wrapping_line/baseline2/screen:3')
   -- try to move the cursor earlier in the third screen line by clicking the mouse
   local screen_left_margin = 25  -- pixels
-  App.run_after_mousepress(screen_left_margin+8,Margin_top+Line_height*2+5, '1')
+  App.run_after_mouserelease(screen_left_margin+8,Margin_top+Line_height*2+5, '1')
   -- cursor should move
   check_eq(Cursor1.line, 1, 'F - test_move_cursor_using_mouse/cursor:line')
   check_eq(Cursor1.pos, 26, 'F - test_move_cursor_using_mouse/cursor:pos')
@@ -1980,6 +1980,10 @@ function Text.to1(pos2)
   return result
 end
 
+function Text.eq1(a, b)
+  return a.line == b.line and a.pos == b.pos
+end
+
 function Text.lt1(a, b)
   if a.line < b.line then
     return true