Skip to content

Commit

Permalink
Fix terminal widget flickering on resize (#12587)
Browse files Browse the repository at this point in the history
Co-authored-by: Meng Zhang <meng.zhang@terapines.com>
  • Loading branch information
msujew and meng-jpg authored Jun 1, 2023
1 parent b59581b commit 0caea2c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/terminal/src/browser/terminal-widget-impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import { CommandLineOptions, ShellCommandBuilder } from '@theia/process/lib/comm
import { Key } from '@theia/core/lib/browser/keys';
import { nls } from '@theia/core/lib/common/nls';
import { TerminalMenus } from './terminal-frontend-contribution';
import debounce = require('p-debounce');

export const TERMINAL_WIDGET_FACTORY_ID = 'terminal';

Expand Down Expand Up @@ -758,7 +759,12 @@ export class TerminalWidgetImpl extends TerminalWidget implements StatefulWidget
super.dispose();
}

protected resizeTerminal(): void {
protected resizeTerminal = debounce(() => this.doResizeTerminal(), 50);

protected doResizeTerminal(): void {
if (this.isDisposed) {
return;
}
const geo = this.fitAddon.proposeDimensions();
const cols = geo.cols;
const rows = geo.rows - 1; // subtract one row for margin
Expand Down

0 comments on commit 0caea2c

Please sign in to comment.