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
1 changed files with 9 additions and 5 deletions

View File

@ -70,14 +70,18 @@ local commands = {
end,
["doc:cut"] = function()
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()
if doc():has_selection() then
local text = doc():get_text(doc():get_selection())
system.set_clipboard(text)
end
end,
["doc:paste"] = function()