Skip to content

Commit

Permalink
Use app shell methods for expand / collapse for toggle terminal comma…
Browse files Browse the repository at this point in the history
…nd (#13131)

* Use app shell methods for expand / collapse

Signed-off-by: Bryan Chen <[email protected]>
  • Loading branch information
bryanchenmchp authored Dec 14, 2023
1 parent 2b1c71e commit c30a79f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

- [Previous Changelogs](https://github.com/eclipse-theia/theia/tree/master/doc/changelogs/)

## Unreleased
- [terminal] Use application shell methods for expanding/collapsing bottom panel for "Terminal: Toggle Terminal" command [#13131](https://github.com/eclipse-theia/theia/pull/13131)

## v1.44.0 - 11/30/2023

- [application-manager] added option to copy `trash` dependency to the bundle [#13112](https://github.com/eclipse-theia/theia/pull/13112)
Expand Down
12 changes: 4 additions & 8 deletions packages/terminal/src/browser/terminal-frontend-contribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -637,28 +637,24 @@ export class TerminalFrontendContribution implements FrontendApplicationContribu
}

protected toggleTerminal(): void {

const terminals = this.shell.getWidgets('bottom').filter(w => w instanceof TerminalWidget);

if (terminals.length === 0) {
this.openTerminal();
return;
}

if (this.shell.bottomPanel.isHidden) {
this.shell.bottomPanel.setHidden(false);
if (!this.shell.isExpanded('bottom')) {
this.shell.expandPanel('bottom');
terminals[0].activate();
return;
}

if (this.shell.bottomPanel.isVisible) {
} else {
const visibleTerminal = terminals.find(t => t.isVisible);
if (!visibleTerminal) {
this.shell.bottomPanel.activateWidget(terminals[0]);
} else if (this.shell.activeWidget !== visibleTerminal) {
this.shell.bottomPanel.activateWidget(visibleTerminal);
} else {
this.shell.bottomPanel.setHidden(true);
this.shell.collapsePanel('bottom');
}
}

Expand Down

0 comments on commit c30a79f

Please sign in to comment.