fixed #194 - added hotkeys to scroll the terminal

This commit is contained in:
Eugene Pankov 2022-07-30 00:05:44 +02:00
parent 5d383eea04
commit c43137b8f6
No known key found for this signature in database
GPG Key ID: 5896FCBBDD1CF4F4
5 changed files with 44 additions and 1 deletions

View File

@ -279,6 +279,15 @@ export class BaseTerminalTabComponent extends BaseTabComponent implements OnInit
case 'copy-current-path':
this.copyCurrentPath()
break
case 'scroll-to-top':
this.frontend?.scrollToTop()
break
case 'scroll-up':
this.frontend?.scrollPages(-1)
break
case 'scroll-down':
this.frontend?.scrollPages(1)
break
case 'scroll-to-bottom':
this.frontend?.scrollToBottom()
break

View File

@ -5,7 +5,6 @@ export class TerminalConfigProvider extends ConfigProvider {
defaults = {
hotkeys: {
'copy-current-path': [],
'scroll-to-bottom': [],
},
terminal: {
frontend: 'xterm',
@ -113,6 +112,10 @@ export class TerminalConfigProvider extends ConfigProvider {
'pane-focus-all': [
'⌘-Shift-I',
],
'scroll-to-top': ['Shift-PageUp'],
'scroll-up': ['PageUp'],
'scroll-down': ['PageDown'],
'scroll-to-bottom': ['Shift-PageDown'],
},
},
[Platform.Windows]: {
@ -157,6 +160,10 @@ export class TerminalConfigProvider extends ConfigProvider {
'pane-focus-all': [
'Ctrl-Shift-I',
],
'scroll-to-top': ['Ctrl-PageUp'],
'scroll-up': ['PageUp'],
'scroll-down': ['PageDown'],
'scroll-to-bottom': ['Ctrl-PageDown'],
},
},
[Platform.Linux]: {
@ -199,6 +206,10 @@ export class TerminalConfigProvider extends ConfigProvider {
'pane-focus-all': [
'Ctrl-Shift-I',
],
'scroll-to-top': ['Ctrl-PageUp'],
'scroll-up': ['PageUp'],
'scroll-down': ['PageDown'],
'scroll-to-bottom': ['Ctrl-PageDown'],
},
},
}

View File

@ -75,6 +75,9 @@ export abstract class Frontend {
abstract write (data: string): Promise<void>
abstract clear (): void
abstract visualBell (): void
abstract scrollToTop (): void
abstract scrollPages (pages: number): void
abstract scrollToBottom (): void
abstract configure (): void

View File

@ -328,6 +328,14 @@ export class XTermFrontend extends Frontend {
}
}
scrollToTop (): void {
this.xterm.scrollToTop()
}
scrollPages (pages: number): void {
this.xterm.scrollPages(pages)
}
scrollToBottom (): void {
this.xtermCore._scrollToBottom()
}

View File

@ -73,6 +73,18 @@ export class TerminalHotkeyProvider extends HotkeyProvider {
id: 'pane-focus-all',
name: this.translate.instant('Focus all panes at once (broadcast)'),
},
{
id: 'scroll-to-top',
name: this.translate.instant('Scroll terminal to top'),
},
{
id: 'scroll-up',
name: this.translate.instant('Scroll terminal one page up'),
},
{
id: 'scroll-down',
name: this.translate.instant('Scroll terminal one page down'),
},
{
id: 'scroll-to-bottom',
name: this.translate.instant('Scroll terminal to bottom'),