added a new right click behaviour matching windows terminal - fixed #7083

This commit is contained in:
Eugene Pankov 2022-10-03 21:34:41 +02:00
parent 512d2dace8
commit 48afeb98a5
No known key found for this signature in database
GPG key ID: 5896FCBBDD1CF4F4
3 changed files with 20 additions and 27 deletions

View file

@ -609,10 +609,20 @@ export class BaseTerminalTabComponent extends BaseTabComponent implements OnInit
protected async handleRightMouseUp (event: MouseEvent): Promise<void> {
event.preventDefault()
event.stopPropagation()
if (this.config.store.terminal.rightClick === 'paste') {
if (this.config.store.terminal.rightClick === 'paste'
|| this.config.store.terminal.rightClick === 'clipboard') {
const duration = Date.now() - this.rightMouseDownTime
if (duration < 250) {
this.paste()
if (this.config.store.terminal.rightClick === 'paste') {
this.paste()
} else if (this.config.store.terminal.rightClick === 'clipboard') {
if (this.frontend?.getSelection()) {
this.frontend.copySelection()
this.frontend.clearSelection()
} else {
this.paste()
}
}
} else {
this.platform.popupContextMenu(await this.buildContextMenu(), event)
}

View file

@ -71,32 +71,15 @@ div.mt-4
.header
.title(translate) Right click
.description(*ngIf='config.store.terminal.rightClick == "paste"', translate) Long-click for context menu
.btn-group(
select.form-control(
[(ngModel)]='config.store.terminal.rightClick',
(ngModelChange)='config.save()',
ngbRadioGroup
(ngModelChange)='config.save()'
)
label.btn.btn-secondary(ngbButtonLabel)
input(
type='radio',
ngbButton,
value='off'
)
span(translate) Off
label.btn.btn-secondary(ngbButtonLabel)
input(
type='radio',
ngbButton,
value='menu'
)
span(translate) Context menu
label.btn.btn-secondary(ngbButtonLabel)
input(
type='radio',
ngbButton,
value='paste'
)
span(translate) Paste
option(ngValue='off', translate) Off
option(ngValue='menu', translate) Context menu
option(ngValue='paste', translate) Paste
option(ngValue='clipboard', translate) Paste if no selection, else copy
.form-line
.header

View file

@ -122,7 +122,7 @@ export class TerminalConfigProvider extends ConfigProvider {
[Platform.Windows]: {
terminal: {
font: 'Consolas',
rightClick: 'paste',
rightClick: 'clipboard',
pasteOnMiddleClick: false,
copyOnSelect: true,
},