Skip to content

Commit

Permalink
Fix terminal widget flickering on resize
Browse files Browse the repository at this point in the history
  • Loading branch information
msujew committed Jun 1, 2023
1 parent b59581b commit 6ab16d5
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 6ab16d5

Please sign in to comment.