Made cut/copy no-op if there is no selection

This commit is contained in:
rxi 2020-04-12 11:22:06 +01:00
parent 1be7a32c6b
commit 7046bfca24

View file

@ -70,14 +70,18 @@ local commands = {
end, end,
["doc:cut"] = function() ["doc:cut"] = function()
local text = doc():get_text(doc():get_selection()) if doc():has_selection() then
system.set_clipboard(text) local text = doc():get_text(doc():get_selection())
doc():delete_to(0) system.set_clipboard(text)
doc():delete_to(0)
end
end, end,
["doc:copy"] = function() ["doc:copy"] = function()
local text = doc():get_text(doc():get_selection()) if doc():has_selection() then
system.set_clipboard(text) local text = doc():get_text(doc():get_selection())
system.set_clipboard(text)
end
end, end,
["doc:paste"] = function() ["doc:paste"] = function()