about summary refs log tree commit diff stats
path: root/main.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 /main.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 'main.lua')
-rw-r--r--main.lua7
1 files changed, 5 insertions, 2 deletions
diff --git a/main.lua b/main.lua
index 5a42309..22585cf 100644
--- a/main.lua
+++ b/main.lua
@@ -341,8 +341,8 @@ function App.mousepressed(x,y, mouse_button)
   for line_index,line in ipairs(Lines) do
     if line.mode == 'text' then
       if Text.in_line(line_index,line, x,y) then
-        -- delicate dance between cursor, selection and old cursor
-        -- manual tests:
+        -- delicate dance between cursor, selection and old cursor/selection
+        -- scenarios:
         --  regular press+release: sets cursor, clears selection
         --  shift press+release:
         --    sets selection to old cursor if not set otherwise leaves it untouched
@@ -396,6 +396,9 @@ function App.mousereleased(x,y, button)
             end
           end
           Old_cursor1, Old_selection1, Mousepress_shift = nil
+          if eq(Cursor1, Selection1) then
+            Selection1 = {}
+          end
           break
         end
       end