copy-on-select and right click behaviour settings (fixes #201)

This commit is contained in:
Eugene Pankov 2017-11-16 22:37:41 +01:00
parent c73d39026b
commit 39e2c386f0
3 changed files with 90 additions and 29 deletions

View File

@ -228,16 +228,29 @@
)
| ▁
.form-group
label Shell
select.form-control(
'[(ngModel)]'='config.store.terminal.shell',
(ngModelChange)='config.save()',
)
option(
*ngFor='let shell of shells',
[ngValue]='shell.id'
) {{shell.name}}
.d-flex
.form-group.mr-3
label Shell
select.form-control(
'[(ngModel)]'='config.store.terminal.shell',
(ngModelChange)='config.save()',
)
option(
*ngFor='let shell of shells',
[ngValue]='shell.id'
) {{shell.name}}
.form-group
label Session persistence
select.form-control(
'[(ngModel)]'='config.store.terminal.persistence',
(ngModelChange)='config.save()',
)
option([ngValue]='null') Off
option(
*ngFor='let provider of persistenceProviders',
[ngValue]='provider.id'
) {{provider.displayName}}
.form-group(*ngIf='config.store.terminal.shell == "custom"')
label Custom shell
@ -301,18 +314,6 @@
)
| On
.form-group
label Session persistence
select.form-control(
'[(ngModel)]'='config.store.terminal.persistence',
(ngModelChange)='config.save()',
)
option([ngValue]='null') Off
option(
*ngFor='let provider of persistenceProviders',
[ngValue]='provider.id'
) {{provider.displayName}}
.form-group
label Auto-open a terminal on app start
br
@ -335,3 +336,50 @@
[value]='true'
)
| On
.d-flex
.form-group.mr-3
label Copy on select
br
.btn-group(
'[(ngModel)]'='config.store.terminal.copyOnSelect',
(ngModelChange)='config.save()',
ngbRadioGroup
)
label.btn.btn-secondary(ngbButtonLabel)
input(
type='radio',
ngbButton,
[value]='false'
)
| Off
label.btn.btn-secondary(ngbButtonLabel)
input(
type='radio',
ngbButton,
[value]='true'
)
| On
.form-group
label Right click behaviour
br
.btn-group(
'[(ngModel)]'='config.store.terminal.rightClick',
(ngModelChange)='config.save()',
ngbRadioGroup
)
label.btn.btn-secondary(ngbButtonLabel)
input(
type='radio',
ngbButton,
value='menu'
)
| Menu
label.btn.btn-secondary(ngbButtonLabel)
input(
type='radio',
ngbButton,
value='paste'
)
| Paste

View File

@ -183,7 +183,7 @@ export class TerminalTabComponent extends BaseTabComponent {
label: 'Paste',
click: () => {
this.zone.run(() => {
this.sendInput(this.electron.clipboard.readText())
this.paste()
})
}
},
@ -228,12 +228,17 @@ export class TerminalTabComponent extends BaseTabComponent {
this.mouseEvent$.next(event)
if (event.type === 'mousedown') {
if (event.which === 3) {
this.contextMenu.popup({
x: event.pageX + this.content.nativeElement.getBoundingClientRect().left,
y: event.pageY + this.content.nativeElement.getBoundingClientRect().top,
async: true,
})
if (this.config.store.terminal.rightClick === 'menu') {
this.contextMenu.popup({
x: event.pageX + this.content.nativeElement.getBoundingClientRect().left,
y: event.pageY + this.content.nativeElement.getBoundingClientRect().top,
async: true,
})
} else if (this.config.store.terminal.rightClick === 'paste') {
this.paste()
}
event.preventDefault()
event.stopPropagation()
return
}
}
@ -307,6 +312,10 @@ export class TerminalTabComponent extends BaseTabComponent {
this.io.writeUTF8(data)
}
paste () {
this.sendInput(this.electron.clipboard.readText())
}
clear () {
this.hterm.wipeContents()
this.hterm.onVTKeystroke('\f')
@ -324,7 +333,7 @@ export class TerminalTabComponent extends BaseTabComponent {
preferenceManager.set('send-encoding', 'raw')
preferenceManager.set('ctrl-plus-minus-zero-zoom', false)
preferenceManager.set('scrollbar-visible', this.hostApp.platform === Platform.macOS)
preferenceManager.set('copy-on-select', false)
preferenceManager.set('copy-on-select', config.terminal.copyOnSelect)
preferenceManager.set('alt-sends-what', 'browser-key')
preferenceManager.set('alt-gr-mode', 'ctrl-alt')
preferenceManager.set('pass-alt-number', true)

View File

@ -13,6 +13,8 @@ export class TerminalConfigProvider extends ConfigProvider {
cursor: 'block',
cursorBlink: true,
customShell: '',
rightClick: 'menu',
copyOnSelect: false,
colorScheme: {
__nonStructural: true,
name: 'Material',
@ -80,6 +82,8 @@ export class TerminalConfigProvider extends ConfigProvider {
font: 'Consolas',
shell: 'clink',
persistence: null,
rightClick: 'paste',
copyOnSelect: true,
},
hotkeys: {
'copy': [