Commit 3846c1d
fix(import): gate progress spinner ANSI on ShouldStyle for legacy consoles
The import progress spinner (#1848) drew its animated frames with
cursor-control escapes (\r\033[K) whenever the writer was a terminal,
gating only on IsTerminalWriter and bypassing interactive.ShouldStyle —
the repo's single gate for writer-scoped ANSI. On a console that can't
render ANSI (TERM=cygwin renders the ESC byte as a literal "←", GH #1267)
or when NO_COLOR is set, every frame emitted "←[K" garbage. The per-frame
\033[K this PR added widened a previously stop-line-only escape to the
whole animation, so legacy Windows consoles regressed from clean bare-\r
frames to visible garbage.
- startUpdatableSpinner: fall back to the completion-line-only (ANSI-free)
path unless w both is a terminal and ShouldStyle(w) — fixes it at the
source for every spinner caller, not just import.
- newImportProgressReporter: route non-styleable terminals to the plain
per-session line path (same as non-TTY/ACCESSIBLE), so NO_COLOR/cygwin
users still get per-session progress instead of a lone final line.
- setup_import_test.go: correct a comment naming a test
(TestNewImportProgressReporter_TTYAdvancesOnSkip) that does not exist.
The terminal+!ShouldStyle branch is only observable against a real TTY, so
it carries no unit test — matching the PR's existing PTY-bound coverage
limits; the shouldStyle decision itself is already unit-tested.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Entire-Checkpoint: 01KYM4JTVVADFMT258B3020DV91 parent 035efd7 commit 3846c1d
3 files changed
Lines changed: 23 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
18 | | - | |
19 | | - | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
20 | 23 | | |
21 | | - | |
| 24 | + | |
22 | 25 | | |
23 | 26 | | |
24 | 27 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
36 | | - | |
| 36 | + | |
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
41 | 48 | | |
42 | 49 | | |
43 | 50 | | |
| |||
52 | 59 | | |
53 | 60 | | |
54 | 61 | | |
55 | | - | |
| 62 | + | |
56 | 63 | | |
57 | 64 | | |
58 | 65 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
380 | 380 | | |
381 | 381 | | |
382 | 382 | | |
383 | | - | |
384 | | - | |
385 | | - | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
386 | 390 | | |
387 | 391 | | |
388 | 392 | | |
| |||
0 commit comments