1
1
mirror of https://github.com/Eugeny/tabby.git synced 2024-11-23 21:34:13 +03:00

paste as a configurable hotkey (fixes #260)

This commit is contained in:
Eugene Pankov 2018-03-30 23:33:46 +02:00
parent b5f96a59f8
commit f947fe3f0f
3 changed files with 22 additions and 4 deletions

View File

@ -93,6 +93,9 @@ export class TerminalTabComponent extends BaseTabComponent {
case 'copy':
this.hterm.copySelectionToClipboard()
break
case 'paste':
this.paste()
break
case 'clear':
this.clear()
break
@ -231,10 +234,7 @@ export class TerminalTabComponent extends BaseTabComponent {
hterm.primaryScreen_.terminal = hterm
hterm.alternateScreen_.terminal = hterm
const _onPaste = hterm.scrollPort_.onPaste_.bind(hterm.scrollPort_)
hterm.scrollPort_.onPaste_ = (event) => {
hterm.scrollPort_.pasteTarget_.value = event.clipboardData.getData('text/plain').trim()
_onPaste()
event.preventDefault()
}
@ -336,7 +336,12 @@ export class TerminalTabComponent extends BaseTabComponent {
}
paste () {
this.sendInput(this.electron.clipboard.readText())
let data = this.electron.clipboard.readText()
data = this.hterm.keyboard.encode(data)
if (this.hterm.options_.bracketedPaste) {
data = '\x1b[200~' + data + '\x1b[201~'
}
this.sendInput(data)
}
clear () {

View File

@ -56,6 +56,9 @@ export class TerminalConfigProvider extends ConfigProvider {
'copy': [
'⌘-C',
],
'paste': [
'⌘-V',
],
'clear': [
'⌘-K',
],
@ -96,6 +99,9 @@ export class TerminalConfigProvider extends ConfigProvider {
'copy': [
'Ctrl-Shift-C',
],
'paste': [
'Ctrl-Shift-V',
],
'clear': [
'Ctrl-L',
],
@ -133,6 +139,9 @@ export class TerminalConfigProvider extends ConfigProvider {
'copy': [
'Ctrl-Shift-C',
],
'paste': [
'Ctrl-Shift-V',
],
'clear': [
'Ctrl-L',
],

View File

@ -8,6 +8,10 @@ export class TerminalHotkeyProvider extends HotkeyProvider {
id: 'copy',
name: 'Copy to clipboard',
},
{
id: 'paste',
name: 'Paste from clipboard',
},
{
id: 'home',
name: 'Beginning of the line',