about summary refs log tree commit diff stats
path: root/select.lua
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2022-06-09 18:27:09 -0700
committerKartik K. Agaram <vc@akkartik.com>2022-06-09 18:27:09 -0700
commit4476eb894615d07797c8db46025f611bb50cefd4 (patch)
tree27903b3530909649ef67fda485645284773ad1b8 /select.lua
parent6ba10b4de61f1bce61bb946a0d023cf4969fdefe (diff)
downloadtext.love-4476eb894615d07797c8db46025f611bb50cefd4.tar.gz
bugfix: cut (C-x) without first selecting anything
Diffstat (limited to 'select.lua')
-rw-r--r--select.lua2
1 files changed, 2 insertions, 0 deletions
diff --git a/select.lua b/select.lua
index 1121085..db875e3 100644
--- a/select.lua
+++ b/select.lua
@@ -103,12 +103,14 @@ function Text.to_pos(x,y)
 end
 
 function Text.cut_selection()
+  if Selection1.line == nil then return end
   local result = Text.selection()
   Text.delete_selection()
   return result
 end
 
 function Text.delete_selection()
+  if Selection1.line == nil then return end
   local minl,maxl = minmax(Selection1.line, Cursor1.line)
   local before = snapshot(minl, maxl)
   Text.delete_selection_without_undo()