about summary refs log tree commit diff stats
path: root/edit.lua
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2024-06-23 10:53:19 -0700
committerKartik K. Agaram <vc@akkartik.com>2024-06-23 10:53:19 -0700
commit91a08eec2b39a38db9a6952a5701617da549d970 (patch)
tree52c91c2a7c3e411ae6908faef4fa5a3996b94da7 /edit.lua
parenta2f526ad1951679529fc75775fcb9847455c0714 (diff)
downloadlines.love-main.tar.gz
use deepcopy where possible HEAD main
It's shorter and conveys intent better.
Diffstat (limited to 'edit.lua')
-rw-r--r--edit.lua4
1 files changed, 2 insertions, 2 deletions
diff --git a/edit.lua b/edit.lua
index afff2ca..219689d 100644
--- a/edit.lua
+++ b/edit.lua
@@ -303,7 +303,7 @@ function edit.mouse_release(State, x,y, mouse_button)
   else
 --?     print_and_log('edit.mouse_release: no current drawing')
     if y < State.top then
-      State.cursor1 = {line=State.screen_top1.line, pos=State.screen_top1.pos}
+      State.cursor1 = deepcopy(State.screen_top1)
       edit.clean_up_mouse_press(State)
       return
     end
@@ -346,7 +346,7 @@ end
 
 function edit.mouse_wheel_move(State, dx,dy)
   if dy > 0 then
-    State.cursor1 = {line=State.screen_top1.line, pos=State.screen_top1.pos}
+    State.cursor1 = deepcopy(State.screen_top1)
     edit.put_cursor_on_next_text_line(State)
     for i=1,math.floor(dy) do
       Text.up(State)