mirror of
https://github.com/Eugeny/tabby.git
synced 2025-06-27 23:10:04 +00:00
added support for long-clicking for context menu when right click is set to paste (#4858)
This commit is contained in:
parent
a1dbcdbae3
commit
39389f77d0
@ -565,13 +565,27 @@ export class BaseTerminalTabComponent extends BaseTabComponent implements OnInit
|
|||||||
this.termContainerSubscriptions.cancelAll()
|
this.termContainerSubscriptions.cancelAll()
|
||||||
}
|
}
|
||||||
|
|
||||||
protected async handleRightClick (event: MouseEvent): Promise<void> {
|
private rightMouseDownTime = 0
|
||||||
|
|
||||||
|
protected async handleRightMouseDown (event: MouseEvent): Promise<void> {
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
event.stopPropagation()
|
event.stopPropagation()
|
||||||
|
this.rightMouseDownTime = Date.now()
|
||||||
if (this.config.store.terminal.rightClick === 'menu') {
|
if (this.config.store.terminal.rightClick === 'menu') {
|
||||||
this.platform.popupContextMenu(await this.buildContextMenu(), event)
|
this.platform.popupContextMenu(await this.buildContextMenu(), event)
|
||||||
} else if (this.config.store.terminal.rightClick === 'paste') {
|
}
|
||||||
this.paste()
|
}
|
||||||
|
|
||||||
|
protected async handleRightMouseUp (event: MouseEvent): Promise<void> {
|
||||||
|
event.preventDefault()
|
||||||
|
event.stopPropagation()
|
||||||
|
if (this.config.store.terminal.rightClick === 'paste') {
|
||||||
|
const duration = Date.now() - this.rightMouseDownTime
|
||||||
|
if (duration < 250) {
|
||||||
|
this.paste()
|
||||||
|
} else {
|
||||||
|
this.platform.popupContextMenu(await this.buildContextMenu(), event)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -611,7 +625,13 @@ export class BaseTerminalTabComponent extends BaseTabComponent implements OnInit
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (event.which === 3 || event.which === 1 && event.ctrlKey) {
|
if (event.which === 3 || event.which === 1 && event.ctrlKey) {
|
||||||
this.handleRightClick(event)
|
this.handleRightMouseDown(event)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (event.type === 'mouseup') {
|
||||||
|
if (event.which === 3 || event.which === 1 && event.ctrlKey) {
|
||||||
|
this.handleRightMouseUp(event)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -49,6 +49,7 @@ h3.mb-3 Terminal
|
|||||||
.form-line
|
.form-line
|
||||||
.header
|
.header
|
||||||
.title Right click
|
.title Right click
|
||||||
|
.description(*ngIf='config.store.terminal.rightClick == "paste"') Long-click for context menu
|
||||||
.btn-group(
|
.btn-group(
|
||||||
[(ngModel)]='config.store.terminal.rightClick',
|
[(ngModel)]='config.store.terminal.rightClick',
|
||||||
(ngModelChange)='config.save()',
|
(ngModelChange)='config.save()',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user