Skip to content

Commit

Permalink
cmd-k to clear the terminal (fixes #39)
Browse files Browse the repository at this point in the history
  • Loading branch information
Eugeny committed Jul 5, 2017
1 parent f4eb03f commit c087a96
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
8 changes: 8 additions & 0 deletions terminus-terminal/src/components/terminalTab.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ export class TerminalTabComponent extends BaseTabComponent {
if (hotkey === 'copy') {
this.hterm.copySelectionToClipboard()
}
if (hotkey === 'clear') {
this.clear()
}
if (hotkey === 'zoom-in') {
this.zoomIn()
}
Expand Down Expand Up @@ -234,6 +237,11 @@ export class TerminalTabComponent extends BaseTabComponent {
this.io.writeUTF8(data)
}

clear () {
this.hterm.wipeContents()
this.hterm.onVTKeystroke('\f')
}

async configure (): Promise<void> {
let config = this.config.store
preferenceManager.set('font-family', config.terminal.font)
Expand Down
9 changes: 9 additions & 0 deletions terminus-terminal/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ export class TerminalConfigProvider extends ConfigProvider {
'copy': [
'⌘-C',
],
'clear': [
'⌘-K',
],
'zoom-in': [
'⌘-=',
'⌘-Shift-+',
Expand Down Expand Up @@ -75,6 +78,9 @@ export class TerminalConfigProvider extends ConfigProvider {
'copy': [
'Ctrl-Shift-C',
],
'clear': [
'Ctrl-L',
],
'zoom-in': [
'Ctrl-=',
'Ctrl-Shift-+',
Expand Down Expand Up @@ -102,6 +108,9 @@ export class TerminalConfigProvider extends ConfigProvider {
'copy': [
'Ctrl-Shift-C',
],
'clear': [
'Ctrl-L',
],
'zoom-in': [
'Ctrl-=',
'Ctrl-Shift-+',
Expand Down
4 changes: 4 additions & 0 deletions terminus-terminal/src/hotkeys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ export class TerminalHotkeyProvider extends HotkeyProvider {
id: 'copy',
name: 'Copy to clipboard',
},
{
id: 'clear',
name: 'Clear terminal',
},
{
id: 'zoom-in',
name: 'Zoom in',
Expand Down

0 comments on commit c087a96

Please sign in to comment.