-
-
Notifications
You must be signed in to change notification settings - Fork 397
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(terminal): widget flickering on resize
Ref: eclipse-theia/theia#12587 Signed-off-by: dankeboy36 <[email protected]>
- Loading branch information
1 parent
42d017e
commit 0bcb182
Showing
2 changed files
with
28 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
arduino-ide-extension/src/browser/theia/terminal/terminal-widget-impl.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { injectable } from '@theia/core/shared/inversify'; | ||
import { TerminalWidgetImpl as TheiaTerminalWidgetImpl } from '@theia/terminal/lib/browser/terminal-widget-impl'; | ||
import debounce from 'p-debounce'; | ||
|
||
// Patch for https://github.com/eclipse-theia/theia/pull/12587 | ||
@injectable() | ||
export class TerminalWidgetImpl extends TheiaTerminalWidgetImpl { | ||
private readonly debouncedResizeTerminal = debounce( | ||
() => this.doResizeTerminal(), | ||
50 | ||
); | ||
|
||
protected override resizeTerminal(): void { | ||
this.debouncedResizeTerminal(); | ||
} | ||
|
||
private doResizeTerminal(): void { | ||
const geo = this.fitAddon.proposeDimensions(); | ||
const cols = geo.cols; | ||
const rows = geo.rows - 1; // subtract one row for margin | ||
this.term.resize(cols, rows); | ||
} | ||
} |