Commit 7ba2fc7
authored
ui: migrate charmbracelet stack to v2 (#1054)
Upgrades to charmbracelet's v2 libraries
(lipgloss, bubbletea, and bubbles, https://charm.land/blog/v2/).
This required significantly reworking our rendering pipeline,
as well as some workarounds on the test/simulation side
to accommodate improvements made on the Bubble Tea side.
## Render-time styling
Upgrade the TUI stack to `bubbles`, `bubbletea`, and `lipgloss`
v2,
and reshape the rendering pipeline around the API changes those
releases require.
Lip Gloss v2 resolves adaptive colors against the active output stream
at render time,
so the UI now carries semantic `ui.Style` and `ui.Theme` values until
it writes output.
That keeps call sites expressive while letting the output layer decide
how much styling the destination can support.
## Bubble Tea v2 integration
Bubble Tea v2 also changes the terminal contract.
Forms now implement `View() tea.View`,
key handling moves to `tea.KeyPressMsg`,
and startup sizing is configured through program options.
Those updates are mostly mechanical,
but they require the interactive layer to pass theme and window-size
state through every field consistently.
## Test harness and terminal emulation
The migration also forced the scripted UI harnesses to behave more like
real terminals.
The emulator now preserves raw-terminal newline semantics,
treats tabs as cursor movement,
and waits for the screen to settle before assertions snapshot the
result.
That keeps Bubble Tea v2 redraw bursts from leaking intermediate frames
into fixtures.
Robot-driven prompt fixtures need the same output-capability handling.
`lipgloss.Style.Render` still returns ANSI sequences even when tests
are recording prompt text into plain files.
`uitest.RobotView` now captures prompt and log output through a
`colorprofile.Writer` forced to `NoTTY`,
so script fixtures observe the same unstyled text that a non-terminal
destination would receive.
A regression test locks that behavior down for future UI changes.
The PTY-based `with-term` harness also needs a deterministic theme.
Its scripted terminal does not answer background-color probes,
so detecting the active theme can block interactive startup before the
first prompt is drawn.
`ui.detectTheme` now honors a test-only `__GIT_SPICE_THEME` override,
and `with-term` sets it explicitly so PTY-driven script tests can boot
without stalling on terminal queries.
## Output capability detection
The migration also changes how non-interactive output is written.
`ui.NewFileView` wraps outputs with `colorprofile.Writer`
and records the detected theme alongside the writer.
That preserves colored branch-tree and log output when the destination
supports it,
while still stripping or down-sampling styles when it does not.1 parent 228eb05 commit 7ba2fc7
File tree
57 files changed
+1597
-493
lines changed- .changes/unreleased
- doc
- internal
- forge
- bitbucket
- github
- gitlab
- handler
- split
- track
- silog
- termtest
- ui
- branchtree
- commit
- fliptree
- uitest
- widget
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
57 files changed
+1597
-493
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
39 | 44 | | |
40 | 45 | | |
41 | 46 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
149 | 149 | | |
150 | 150 | | |
151 | 151 | | |
| 152 | + | |
152 | 153 | | |
153 | | - | |
| 154 | + | |
154 | 155 | | |
155 | 156 | | |
156 | 157 | | |
| |||
168 | 169 | | |
169 | 170 | | |
170 | 171 | | |
171 | | - | |
| 172 | + | |
172 | 173 | | |
173 | 174 | | |
174 | 175 | | |
| |||
213 | 214 | | |
214 | 215 | | |
215 | 216 | | |
216 | | - | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
217 | 222 | | |
218 | 223 | | |
219 | 224 | | |
| |||
224 | 229 | | |
225 | 230 | | |
226 | 231 | | |
227 | | - | |
| 232 | + | |
228 | 233 | | |
229 | 234 | | |
230 | 235 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
91 | | - | |
| 91 | + | |
92 | 92 | | |
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
98 | | - | |
| 98 | + | |
99 | 99 | | |
100 | 100 | | |
101 | 101 | | |
| |||
162 | 162 | | |
163 | 163 | | |
164 | 164 | | |
165 | | - | |
| 165 | + | |
166 | 166 | | |
167 | 167 | | |
168 | 168 | | |
169 | 169 | | |
170 | | - | |
| 170 | + | |
171 | 171 | | |
172 | 172 | | |
173 | 173 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
97 | | - | |
| 97 | + | |
98 | 98 | | |
99 | 99 | | |
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
104 | | - | |
| 104 | + | |
105 | 105 | | |
106 | 106 | | |
107 | 107 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
6 | 9 | | |
7 | 10 | | |
8 | | - | |
9 | | - | |
10 | | - | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
11 | 14 | | |
12 | 15 | | |
13 | 16 | | |
| |||
18 | 21 | | |
19 | 22 | | |
20 | 23 | | |
21 | | - | |
| 24 | + | |
22 | 25 | | |
23 | 26 | | |
24 | 27 | | |
25 | 28 | | |
26 | 29 | | |
27 | | - | |
| 30 | + | |
28 | 31 | | |
29 | 32 | | |
30 | 33 | | |
| |||
37 | 40 | | |
38 | 41 | | |
39 | 42 | | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
47 | 48 | | |
48 | 49 | | |
49 | 50 | | |
50 | 51 | | |
51 | 52 | | |
52 | 53 | | |
53 | | - | |
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
64 | | - | |
65 | | - | |
66 | | - | |
| 64 | + | |
67 | 65 | | |
68 | 66 | | |
69 | 67 | | |
| |||
76 | 74 | | |
77 | 75 | | |
78 | 76 | | |
79 | | - | |
80 | | - | |
| 77 | + | |
81 | 78 | | |
82 | 79 | | |
83 | 80 | | |
| |||
0 commit comments