1
1
mirror of https://github.com/Eugeny/tabby.git synced 2024-12-04 19:35:13 +03:00

added a select-all shortcut - fixes #3081

This commit is contained in:
Eugene Pankov 2021-04-05 11:10:27 +02:00
parent 797265abb1
commit 247cf6f93e
No known key found for this signature in database
GPG Key ID: 5896FCBBDD1CF4F4
5 changed files with 17 additions and 0 deletions

View File

@ -162,6 +162,9 @@ export class BaseTerminalTabComponent extends BaseTabComponent implements OnInit
case 'paste':
this.paste()
break
case 'select-all':
this.frontend?.selectAll()
break
case 'clear':
this.frontend?.clear()
break

View File

@ -97,6 +97,7 @@ export class TerminalConfigProvider extends ConfigProvider {
clear: [
'⌘-K',
],
'select-all': ['⌘-A'],
'zoom-in': [
'⌘-=',
'⌘-Shift-=',
@ -142,6 +143,7 @@ export class TerminalConfigProvider extends ConfigProvider {
paste: [
'Ctrl-Shift-V',
],
'select-all': ['Ctrl-Shift-A'],
clear: [],
'zoom-in': [
'Ctrl-=',
@ -185,6 +187,7 @@ export class TerminalConfigProvider extends ConfigProvider {
paste: [
'Ctrl-Shift-V',
],
'select-all': ['Ctrl-Shift-A'],
clear: [],
'zoom-in': [
'Ctrl-=',

View File

@ -62,6 +62,7 @@ export abstract class Frontend {
abstract getSelection (): string
abstract copySelection (): void
abstract selectAll (): void
abstract clearSelection (): void
abstract focus (): void
abstract write (data: string): void

View File

@ -33,6 +33,12 @@ export class HTermFrontend extends Frontend {
this.term.copySelectionToClipboard()
}
selectAll (): void {
const content = this.term.getDocument().body.children[0]
const selection = content.ownerDocument.defaultView.getSelection()
selection.setBaseAndExtent(content, 0, content, 1)
}
clearSelection (): void {
this.term.getDocument().getSelection().removeAllRanges()
}

View File

@ -186,6 +186,10 @@ export class XTermFrontend extends Frontend {
}
}
selectAll (): void {
this.xterm.selectAll()
}
clearSelection (): void {
this.xterm.clearSelection()
}