about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2023-12-01 22:03:36 -0800
committerKartik K. Agaram <vc@akkartik.com>2023-12-01 22:03:36 -0800
commit61336b491bc98ebe379af563ae990b7db011ea6a (patch)
tree2624e90bde34b09b0e86c1ffbe1a9fd62728e981
parent01c0b8e8475aa3bda44ad09dcb76fb0cb94d12d1 (diff)
parent8a588880b7e7e808dc73e9e6b7e5eb7a42c1e2cb (diff)
downloadview.love-61336b491bc98ebe379af563ae990b7db011ea6a.tar.gz
Merge lines.love
-rw-r--r--edit.lua2
-rw-r--r--select.lua2
2 files changed, 3 insertions, 1 deletions
diff --git a/edit.lua b/edit.lua
index bfd2709..8a7cd10 100644
--- a/edit.lua
+++ b/edit.lua
@@ -151,6 +151,7 @@ end
 
 function edit.mouse_press(State, x,y, mouse_button)
   if State.search_term then return end
+  State.mouse_down = mouse_button
 --?   print_and_log(('edit.mouse_press: cursor at %d,%d'):format(State.cursor1.line, State.cursor1.pos))
   if y < State.top then
     State.old_cursor1 = State.cursor1
@@ -199,6 +200,7 @@ end
 function edit.mouse_release(State, x,y, mouse_button)
   if State.search_term then return end
 --?   print_and_log(('edit.mouse_release(%d,%d): cursor at %d,%d'):format(x,y, State.cursor1.line, State.cursor1.pos))
+  State.mouse_down = nil
   if y < State.top then
     State.cursor1 = {line=State.screen_top1.line, pos=State.screen_top1.pos}
     edit.clean_up_mouse_press(State)
diff --git a/select.lua b/select.lua
index 083d7ab..d37ec61 100644
--- a/select.lua
+++ b/select.lua
@@ -11,7 +11,7 @@ function Text.clip_selection(State, line_index, apos, bpos)
   -- min,max = sorted(State.selection1,State.cursor1)
   local minl,minp = State.selection1.line,State.selection1.pos
   local maxl,maxp
-  if App.mouse_down(1) then
+  if State.mouse_down then
     maxl,maxp = Text.mouse_pos(State)
   else
     maxl,maxp = State.cursor1.line,State.cursor1.pos