about summary refs log tree commit diff stats
path: root/text.lua
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2022-05-26 20:40:50 -0700
committerKartik K. Agaram <vc@akkartik.com>2022-05-26 20:40:50 -0700
commit0fab1b499df3eb887786526b4c38827c2027a1e8 (patch)
tree728a9e26b48910c66d9be7f170dff41ad5e78392 /text.lua
parentdd635546e3b43f7e50de88ccdc8464558f0a028a (diff)
downloadtext.love-0fab1b499df3eb887786526b4c38827c2027a1e8.tar.gz
paste in text with M-v
Diffstat (limited to 'text.lua')
-rw-r--r--text.lua8
1 files changed, 8 insertions, 0 deletions
diff --git a/text.lua b/text.lua
index 0668d17..ac8adbd 100644
--- a/text.lua
+++ b/text.lua
@@ -739,6 +739,8 @@ end
 
 function Text.textinput(t)
   if love.mouse.isDown('1') then return end
+  if App.modifier_down() then return end
+  local down = love.keyboard.isDown
   Text.insert_at_cursor(t)
 end
 
@@ -794,6 +796,12 @@ function Text.keychord_pressed(chord)
         break
       end
     end
+  -- paste
+  elseif chord == 'M-v' then
+    local s = love.system.getClipboardText()
+    for _,code in utf8.codes(s) do
+      Text.insert_at_cursor(utf8.char(code))
+    end
   elseif chord == 'home' then
     Cursor1.pos = 1
   elseif chord == 'end' then