diff options
| author | ruki <[email protected]> | 2018-02-06 22:33:22 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2018-02-06 09:20:13 +0800 |
| commit | 698f2dc400aea41f40a9eccc52b7fdc9db856884 (patch) | |
| tree | 1a21d079b05b96e1afd55ec03395f1cf80aae8ad | |
| parent | 623575fa425b876a17bb7b45a2ff6bb35ee84aba (diff) | |
add pdpaste and pdcopy on linux
| -rw-r--r-- | xmake/core/base/os.lua | 7 | ||||
| -rw-r--r-- | xmake/core/ui/textedit.lua | 6 |
2 files changed, 13 insertions, 0 deletions
diff --git a/xmake/core/base/os.lua b/xmake/core/base/os.lua index 7b3bceca3..3841a9d89 100644 --- a/xmake/core/base/os.lua +++ b/xmake/core/base/os.lua @@ -824,6 +824,11 @@ function os.pbpaste() if ok then return result end + elseif os.host() == "linux" then + local ok, result = os.iorun("xsel --clipboard --output") + if ok then + return result + end else -- TODO end @@ -833,6 +838,8 @@ end function os.pbcopy(data) if os.host() == "macosx" then os.run("bash -c \"echo '" .. data .. "' | pbcopy\"") + elseif os.host() == "linux" then + os.run("bash -c \"echo '" .. data .. "' | xsel --clipboard --input\"") else -- TODO end diff --git a/xmake/core/ui/textedit.lua b/xmake/core/ui/textedit.lua index ea5222140..ed1a92221 100644 --- a/xmake/core/ui/textedit.lua +++ b/xmake/core/ui/textedit.lua @@ -91,6 +91,12 @@ function textedit:event_on(e) self:text_set(text:sub(1, #text - 1)) end return true + elseif e.key_name == "CtrlV" then + local pastetext = os.pbpaste() + if pastetext then + self:text_set(self:text() .. pastetext) + end + return true end end |
