Skip to content

Commit

Permalink
added a new right click behaviour matching windows terminal - fixed #…
Browse files Browse the repository at this point in the history
  • Loading branch information
Eugeny committed Oct 3, 2022
1 parent 512d2da commit 48afeb9
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 27 deletions.
14 changes: 12 additions & 2 deletions tabby-terminal/src/api/baseTerminalTab.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
31 changes: 7 additions & 24 deletions tabby-terminal/src/components/terminalSettingsTab.component.pug
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tabby-terminal/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export class TerminalConfigProvider extends ConfigProvider {
[Platform.Windows]: {
terminal: {
font: 'Consolas',
rightClick: 'paste',
rightClick: 'clipboard',
pasteOnMiddleClick: false,
copyOnSelect: true,
},
Expand Down

0 comments on commit 48afeb9

Please sign in to comment.