fix vTerm paste from clipboard

This commit is contained in:
lxsang
2020-11-29 23:10:42 +01:00
parent ee3cfe92bd
commit 40ff4b4f05
22 changed files with 2732 additions and 6 deletions

File diff suppressed because one or more lines are too long

View File

@@ -6,7 +6,7 @@
"author": "Xuan Sang LE",
"email": "xsang.le@gmail.com"
},
"version":"0.1.4-a",
"version":"0.1.5-a",
"category":"System",
"iconclass":"fa fa-terminal",
"mimes":["none"],

Binary file not shown.

View File

@@ -75,11 +75,22 @@ class vTerm extends this.OS.application.BaseApplication
mctxHandle: (data) ->
switch data.id
when "paste"
@_api.getClipboard().then (text) =>
cb = (text) =>
return unless text and text isnt ""
text = text.replace /\n/g, "\r"
@sub.send Antunnel.Msg.DATA, new TextEncoder("utf-8").encode(text) if @sub
@term.focus()
.catch (e) => @error __("Unable to paste"), e
@_api.getClipboard()
.then (text) =>
cb(text)
.catch (e) =>
@error __("Unable to paste"), e
#ask for user to enter the text manually
@openDialog("TextDialog", { title: "Paste text"})
.then (text) =>
cb(text)
.catch (err) => @error err.toString(), err
when "copy"
text = @term.getSelection()
return unless text and text isnt ""

View File

@@ -6,7 +6,7 @@
"author": "Xuan Sang LE",
"email": "xsang.le@gmail.com"
},
"version":"0.1.4-a",
"version":"0.1.5-a",
"category":"System",
"iconclass":"fa fa-terminal",
"mimes":["none"],