Skip to content

Commit 53dd0ed

Browse files
authored
fix(workspace): keep the last startup log line from wrapping (#1150)
1 parent 01093dc commit 53dd0ed

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

‎src/workspace/workspaceMonitor.ts‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -371,9 +371,11 @@ export class WorkspaceMonitor implements vscode.Disposable {
371371
logs: readonly WorkspaceAgentLog[],
372372
): vscode.Terminal {
373373
const writeEmitter = new vscode.EventEmitter<string>();
374+
// End every line so the cursor sits below the logs: xterm.js never
375+
// reflows the cursor's line, which `open` writes before the final width.
374376
const output = logs
375-
.map((log) => log.output.replace(/\r?\n/g, "\r\n"))
376-
.join("\r\n");
377+
.map((log) => log.output.replace(/\r?\n/g, "\r\n") + "\r\n")
378+
.join("");
377379
return vscode.window.createTerminal({
378380
name,
379381
pty: {

‎test/unit/workspace/workspaceMonitor.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,7 @@ describe("WorkspaceMonitor", () => {
552552

553553
await vi.waitFor(() => {
554554
expect(Object.fromEntries(writes)).toEqual({
555-
"Startup Logs: Install deps": ["installing\r\nnpm ERR!"],
555+
"Startup Logs: Install deps": ["installing\r\nnpm ERR!\r\n"],
556556
});
557557
});
558558
});

0 commit comments

Comments
 (0)