forked from arduino/arduino-ide
-
Notifications
You must be signed in to change notification settings - Fork 0
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 <dankeboy36@gmail.com>
- Loading branch information
1 parent
4d79caa
commit 767cb3d
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); | ||
} | ||
} |