xonecas.io
64875
Mc

mini-coder / commit fcd6929

fix(spinner): keep braille frames four dots tall

xonecas2026-03-11 fcd69296fb2dc48829594f589d5c451b85355b50 parent 888184d

2 files changed

src/cli/spinner.test.ts+17−0
@@ -0,0 +1,17 @@
1+import { describe, expect, test } from "bun:test";
2+import { SPINNER_FRAMES } from "./spinner.ts";
3+
4+const BRAILLE_BASE = 0x2800;
5+const BRAILLE_DOT_7 = 1 << 6;
6+const BRAILLE_DOT_8 = 1 << 7;
7+
8+describe("SPINNER_FRAMES", () => {
9+ test("uses the bottom braille row in every frame so the spinner stays 4 dots tall", () => {
10+ for (const frame of SPINNER_FRAMES) {
11+ const pattern = frame.codePointAt(0);
12+ expect(pattern).toBeDefined();
13+ const dots = (pattern ?? BRAILLE_BASE) - BRAILLE_BASE;
14+ expect((dots & (BRAILLE_DOT_7 | BRAILLE_DOT_8)) !== 0).toBe(true);
15+ }
16+ });
17+});
src/cli/spinner.ts+2−2
@@ -1,6 +1,6 @@
11 import * as c from "yoctocolors";
22
3-const FRAMES = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"];
3+export const SPINNER_FRAMES = ["⣾", "⣽", "⣻", "⢿", "⡿", "⣟", "⣯", "⣷"];
44
55 export class Spinner {
66 private frame = 0;
@@ -27,7 +27,7 @@ export class Spinner {
2727 }
2828
2929 private _tick(): void {
30- const f = FRAMES[this.frame++ % FRAMES.length] ?? "⠋";
30+ const f = SPINNER_FRAMES[this.frame++ % SPINNER_FRAMES.length] ?? "⣾";
3131 const label = this.label ? c.dim(` ${this.label}`) : "";
3232 process.stderr.write(`\r${c.dim(f)}${label}`);
3333 }