1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

Catch xtermjs fit error (#1907)

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
This commit is contained in:
Jari Kolehmainen 2021-01-07 13:06:23 +02:00 committed by GitHub
parent 2543e4aec7
commit 02bc210f56
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -130,10 +130,17 @@ export class Terminal {
fit = () => { fit = () => {
// Since this function is debounced we need to read this value as late as possible // Since this function is debounced we need to read this value as late as possible
if (!this.isActive) return; if (!this.isActive) return;
this.fitAddon.fit();
const { cols, rows } = this.xterm;
this.api.sendTerminalSize(cols, rows); try {
this.fitAddon.fit();
const { cols, rows } = this.xterm;
this.api.sendTerminalSize(cols, rows);
} catch(error) {
console.error(error);
return; // see https://github.com/lensapp/lens/issues/1891
}
}; };
fitLazy = debounce(this.fit, 250); fitLazy = debounce(this.fit, 250);