cmd-k to clear the terminal (fixes #39)

This commit is contained in:
Eugene Pankov 2017-07-05 19:31:58 +02:00
parent f4eb03fee0
commit c087a969d6
3 changed files with 21 additions and 0 deletions

View File

@ -75,6 +75,9 @@ export class TerminalTabComponent extends BaseTabComponent {
if (hotkey === 'copy') { if (hotkey === 'copy') {
this.hterm.copySelectionToClipboard() this.hterm.copySelectionToClipboard()
} }
if (hotkey === 'clear') {
this.clear()
}
if (hotkey === 'zoom-in') { if (hotkey === 'zoom-in') {
this.zoomIn() this.zoomIn()
} }
@ -234,6 +237,11 @@ export class TerminalTabComponent extends BaseTabComponent {
this.io.writeUTF8(data) this.io.writeUTF8(data)
} }
clear () {
this.hterm.wipeContents()
this.hterm.onVTKeystroke('\f')
}
async configure (): Promise<void> { async configure (): Promise<void> {
let config = this.config.store let config = this.config.store
preferenceManager.set('font-family', config.terminal.font) preferenceManager.set('font-family', config.terminal.font)

View File

@ -47,6 +47,9 @@ export class TerminalConfigProvider extends ConfigProvider {
'copy': [ 'copy': [
'⌘-C', '⌘-C',
], ],
'clear': [
'⌘-K',
],
'zoom-in': [ 'zoom-in': [
'⌘-=', '⌘-=',
'⌘-Shift-+', '⌘-Shift-+',
@ -75,6 +78,9 @@ export class TerminalConfigProvider extends ConfigProvider {
'copy': [ 'copy': [
'Ctrl-Shift-C', 'Ctrl-Shift-C',
], ],
'clear': [
'Ctrl-L',
],
'zoom-in': [ 'zoom-in': [
'Ctrl-=', 'Ctrl-=',
'Ctrl-Shift-+', 'Ctrl-Shift-+',
@ -102,6 +108,9 @@ export class TerminalConfigProvider extends ConfigProvider {
'copy': [ 'copy': [
'Ctrl-Shift-C', 'Ctrl-Shift-C',
], ],
'clear': [
'Ctrl-L',
],
'zoom-in': [ 'zoom-in': [
'Ctrl-=', 'Ctrl-=',
'Ctrl-Shift-+', 'Ctrl-Shift-+',

View File

@ -8,6 +8,10 @@ export class TerminalHotkeyProvider extends HotkeyProvider {
id: 'copy', id: 'copy',
name: 'Copy to clipboard', name: 'Copy to clipboard',
}, },
{
id: 'clear',
name: 'Clear terminal',
},
{ {
id: 'zoom-in', id: 'zoom-in',
name: 'Zoom in', name: 'Zoom in',