Skip to content

Commit d45b4b8

Browse files
committed
fix onload width issue with requestAnimationFrame
1 parent eccebc6 commit d45b4b8

File tree

1 file changed

+9
-1
lines changed
  • html/src/components/terminal/xterm

1 file changed

+9
-1
lines changed

html/src/components/terminal/xterm/index.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ export class Xterm {
101101
private reconnect = true;
102102
private doReconnect = true;
103103
private closeOnDisconnect = false;
104+
private preferencesApplied = false;
104105

105106
private writeFunc = (data: ArrayBuffer) => this.writeData(new Uint8Array(data));
106107

@@ -166,7 +167,6 @@ export class Xterm {
166167
terminal.loadAddon(webLinksAddon);
167168

168169
terminal.open(parent);
169-
fitAddon.fit();
170170
}
171171

172172
@bind
@@ -466,6 +466,14 @@ export class Xterm {
466466
break;
467467
}
468468
}
469+
470+
if (!this.preferencesApplied) {
471+
this.preferencesApplied = true;
472+
473+
requestAnimationFrame(() => {
474+
fitAddon.fit();
475+
});
476+
}
469477
}
470478

471479
@bind

0 commit comments

Comments
 (0)