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,
["doc:cut"] = function()
local text = doc():get_text(doc():get_selection())
system.set_clipboard(text)
doc():delete_to(0)
if doc():has_selection() then
local text = doc():get_text(doc():get_selection())
system.set_clipboard(text)
doc():delete_to(0)
end
end,
["doc:copy"] = function()
local text = doc():get_text(doc():get_selection())
system.set_clipboard(text)
if doc():has_selection() then
local text = doc():get_text(doc():get_selection())
system.set_clipboard(text)
end
end,
["doc:paste"] = function()