Skip to content

Commit ed9825f

Browse files
committed
fix(server): recognize opencode spinner redraws
1 parent e688c05 commit ed9825f

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

‎apps/server/src/provider/providerMaintenanceRunner.test.ts‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,15 @@ describe("providerMaintenanceRunner", () => {
396396
);
397397
assert.strictEqual(ProviderMaintenanceRunner.toProgressLine("x".repeat(300))?.length, 200);
398398

399-
for (const redraw of ["\r", "\u001b[G", "\u001b[0G", "\u001b[1G", "\u001b[01G"]) {
399+
for (const redraw of [
400+
"\r",
401+
"\u001b[G",
402+
"\u001b[0G",
403+
"\u001b[1G",
404+
"\u001b[01G",
405+
"\u001b[999D",
406+
"\u001b[999D\u001b[J",
407+
]) {
400408
const output = `first${redraw}second${redraw}last`;
401409
for (let boundary = 0; boundary <= output.length; boundary++) {
402410
let partialLine = "";

‎apps/server/src/provider/providerMaintenanceRunner.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ export function splitOutputLines(
203203
partialLine: string,
204204
text: string,
205205
): { readonly lines: ReadonlyArray<string>; readonly partialLine: string } {
206-
const parts = (partialLine + text).replace(/\x1b\[0*1?G/g, "\r").split(/\r\n|\r|\n/);
206+
const parts = (partialLine + text).replace(/\x1b\[(?:0*1?G|999D)/g, "\r").split(/\r\n|\r|\n/);
207207
return { partialLine: (parts.pop() ?? "").slice(-UPDATE_PARTIAL_LINE_MAX_LENGTH), lines: parts };
208208
}
209209

0 commit comments

Comments
 (0)