From d5697c05f32683e15631ff79ce6962e11b9e1700 Mon Sep 17 00:00:00 2001 From: Yan Chen <48968912+chenyan-dfinity@users.noreply.github.com> Date: Sat, 14 Sep 2024 15:20:17 -0700 Subject: [PATCH] fix terminal size --- src/App.tsx | 1 + src/webcontainer.ts | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/App.tsx b/src/App.tsx index 98462902..410ce5fd 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -69,6 +69,7 @@ const worker = Comlink.wrap( new Worker(new URL("./workers/moc.ts", import.meta.url), { type: "module" }), ); const terminal = new Terminal({ + convertEol: true, cursorBlink: true, fontSize: 14, fontFamily: "monospace", diff --git a/src/webcontainer.ts b/src/webcontainer.ts index 68079a85..d6582b7e 100644 --- a/src/webcontainer.ts +++ b/src/webcontainer.ts @@ -62,7 +62,14 @@ export class Container { args: string[], options?: SpawnOptions, ) { - const process = await this.container!.spawn(cmd, args, options); + const new_options = { + ...options, + terminal: { + cols: this.terminal.cols, + rows: this.terminal.rows, + }, + }; + const process = await this.container!.spawn(cmd, args, new_options); process.output.pipeTo( new WritableStream({ write: (data) => {