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 .d-flex
label Shell .form-group.mr-3
select.form-control( label Shell
'[(ngModel)]'='config.store.terminal.shell', select.form-control(
(ngModelChange)='config.save()', '[(ngModel)]'='config.store.terminal.shell',
) (ngModelChange)='config.save()',
option( )
*ngFor='let shell of shells', option(
[ngValue]='shell.id' *ngFor='let shell of shells',
) {{shell.name}} [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"') .form-group(*ngIf='config.store.terminal.shell == "custom"')
label Custom shell label Custom shell
@ -301,18 +314,6 @@
) )
| On | 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 .form-group
label Auto-open a terminal on app start label Auto-open a terminal on app start
br br
@ -335,3 +336,50 @@
[value]='true' [value]='true'
) )
| On | 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', label: 'Paste',
click: () => { click: () => {
this.zone.run(() => { this.zone.run(() => {
this.sendInput(this.electron.clipboard.readText()) this.paste()
}) })
} }
}, },
@ -228,12 +228,17 @@ export class TerminalTabComponent extends BaseTabComponent {
this.mouseEvent$.next(event) this.mouseEvent$.next(event)
if (event.type === 'mousedown') { if (event.type === 'mousedown') {
if (event.which === 3) { if (event.which === 3) {
this.contextMenu.popup({ if (this.config.store.terminal.rightClick === 'menu') {
x: event.pageX + this.content.nativeElement.getBoundingClientRect().left, this.contextMenu.popup({
y: event.pageY + this.content.nativeElement.getBoundingClientRect().top, x: event.pageX + this.content.nativeElement.getBoundingClientRect().left,
async: true, y: event.pageY + this.content.nativeElement.getBoundingClientRect().top,
}) async: true,
})
} else if (this.config.store.terminal.rightClick === 'paste') {
this.paste()
}
event.preventDefault() event.preventDefault()
event.stopPropagation()
return return
} }
} }
@ -307,6 +312,10 @@ export class TerminalTabComponent extends BaseTabComponent {
this.io.writeUTF8(data) this.io.writeUTF8(data)
} }
paste () {
this.sendInput(this.electron.clipboard.readText())
}
clear () { clear () {
this.hterm.wipeContents() this.hterm.wipeContents()
this.hterm.onVTKeystroke('\f') this.hterm.onVTKeystroke('\f')
@ -324,7 +333,7 @@ export class TerminalTabComponent extends BaseTabComponent {
preferenceManager.set('send-encoding', 'raw') preferenceManager.set('send-encoding', 'raw')
preferenceManager.set('ctrl-plus-minus-zero-zoom', false) preferenceManager.set('ctrl-plus-minus-zero-zoom', false)
preferenceManager.set('scrollbar-visible', this.hostApp.platform === Platform.macOS) 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-sends-what', 'browser-key')
preferenceManager.set('alt-gr-mode', 'ctrl-alt') preferenceManager.set('alt-gr-mode', 'ctrl-alt')
preferenceManager.set('pass-alt-number', true) preferenceManager.set('pass-alt-number', true)

View File

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