rustimal 0.8.0

A minimal, GPU-rendered terminal for Windows that runs Git Bash, with animated split panes and a glass look
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
//! A pane's card: its cells, cursor, search bar, Claude's usage bar and the hints over it.

use super::*;

/// Returns true if the pane needs another frame.
pub(super) fn draw_pane(ctx: &mut Ctx, pane: &mut Pane, out: &mut Vec<Quad>) -> bool {
    let s = ctx.scale;
    let pal = ctx.palette;
    let o = pane.opacity;
    let card = pane.rect;
    if card.w < 1.0 || card.h < 1.0 || o < 0.004 {
        return false;
    }
    let radius = ctx.config.radius * s;
    let pad = (ctx.config.padding * s).round();
    let (cw, ch) = (ctx.glyphs.cell_w, ctx.glyphs.cell_h);
    let focus = pane.focus;

    let see_through = ctx.alpha < 1.0;
    out.push(shadow(card, radius, 14.0 * s, 3.0 * s, if see_through { 0.24 } else { 0.45 } * o, see_through));

    // Card; its edge glows with focus and flashes on bell.
    // Claude panes get a warm ring, even when they are the only pane.
    let (ring_color, ring) =
        if pane.claude { (CLAUDE, focus * ctx.multi.max(0.55)) } else { (pal.accent, focus * ctx.multi) };
    let surface = mix(pal.surface, pal.foreground, pane.bell * 0.03);
    if ctx.glass {
        let mut rim = mix(WHITE, ring_color, ring * 0.85);
        rim = mix(rim, pal.ansi[3], pane.bell * 0.8);
        rim[3] = (0.6 + 0.4 * ring + 0.4 * pane.bell).min(1.0) * o;
        out.push(glass(card, with_alpha(surface, ctx.alpha * o), rim, 0.55 * o, radius, s));
    } else {
        let mut border = mix(pal.border, with_alpha(ring_color, 0.85), ring);
        border = mix(border, pal.ansi[3], pane.bell * 0.8);
        out.push(Quad {
            rect: [card.x, card.y, card.w, card.h],
            uv: [0.0; 4],
            color: with_alpha(surface, o),
            clip: NO_CLIP,
            params: [MODE_ROUNDED, radius, (1.0 * s).max(1.0), 0.0],
            color2: with_alpha(border, o),
        });
    }

    // A conversation takes the terminal's place; the shell carries on underneath.
    if let Some(chat) = pane.chat.as_mut().filter(|c| !c.hidden) {
        crate::agent::chat::draw(ctx, chat, card, o, out);
        draw_veil(ctx, card, focus, o, out);
        return false;
    }
    // So does a review. It is opaque, so while its pane fades only the card is drawn.
    if let Some(view) = pane.review.as_mut().filter(|v| !v.hidden) {
        let again = o > 0.5 && crate::review_ui::draw(ctx, view, card, out);
        draw_veil(ctx, card, focus, o, out);
        return again;
    }

    let ox = (card.x + pad).round();
    let oy = (card.y + pad).round();
    let inner = card.inset((pad * 0.35).max(2.0));
    // Claude panes reserve a strip at the bottom for the usage bar.
    let bar_h = if pane.claude { claude_bar_height(ch, s) } else { 0.0 };
    let clip = [inner.x, inner.y, inner.right(), (inner.bottom() - bar_h).max(inner.y)];

    let term = pane.term.lock();
    let history = term.grid().history_size();
    let content = term.renderable_content();
    let colors = content.colors;
    let mode = content.mode;
    let offset = content.display_offset;
    let selection = content.selection;
    let cursor = content.cursor;
    let rows = pane.grid.rows;

    // Cursor: drawn exactly at its cell (no glide, so it never lags behind typing).
    let cursor_row = cursor.point.line.0 + offset as i32;
    let show_cursor = mode.contains(TermMode::SHOW_CURSOR)
        && cursor.shape != CursorShape::Hidden
        && cursor_row >= 0
        && (cursor_row as usize) < rows;
    let cursor_px = (cursor.point.column.0 as f32 * cw, cursor_row as f32 * ch);
    let block_cursor = show_cursor && ctx.focused && cursor.shape == CursorShape::Block;
    let invert_cell = block_cursor && ctx.cursor_alpha > 0.5;

    ctx.bg.clear();
    ctx.fg.clear();
    let fg_alpha = o;
    let sel_color = with_alpha(pal.selection, o);
    let line_w = (ctx.glyphs.font_px / 14.0).round().max(1.0);
    let baseline = ctx.glyphs.baseline;

    for indexed in content.display_iter {
        let cell = indexed.cell;
        let row = indexed.point.line.0 + offset as i32;
        if row < 0 || row as usize >= rows {
            continue;
        }
        let col = indexed.point.column.0;
        let flags = cell.flags;
        if flags.intersects(Flags::WIDE_CHAR_SPACER | Flags::LEADING_WIDE_CHAR_SPACER) {
            continue;
        }
        let width = if flags.contains(Flags::WIDE_CHAR) { 2.0 } else { 1.0 };
        let x = ox + col as f32 * cw;
        let y = oy + row as f32 * ch;

        let mut fg = resolve(cell.fg, colors, pal);
        let bg_default = matches!(cell.bg, Color::Named(NamedColor::Background));
        let mut bg = resolve(cell.bg, colors, pal);
        let mut has_bg = !bg_default;
        if flags.contains(Flags::INVERSE) {
            std::mem::swap(&mut fg, &mut bg);
            has_bg = true;
        }
        if pane.claude {
            fg = soften_gray(fg, pal, false);
            if has_bg && !bg_default {
                // Keep Claude's panels as see-through as the pane.
                bg = with_alpha(soften_gray(bg, pal, true), ctx.alpha);
            }
        }
        if flags.contains(Flags::DIM) {
            fg = mix(fg, bg, 0.4);
        }
        let selected = selection.is_some_and(|s| s.contains(indexed.point));
        if selected {
            bg = pal.selection;
            has_bg = true;
        }
        if has_bg {
            let c = if selected { sel_color } else { with_alpha(bg, o) };
            ctx.bg.push(quad(Rect::new(x, y, cw * width, ch), c, clip, MODE_SOLID));
        }

        let under_cursor = invert_cell && cursor_row == row && cursor.point.column.0 == col;
        if under_cursor {
            fg = pal.surface;
        }

        let c = cell.c;
        if c != ' ' && c != '\t' && !flags.contains(Flags::HIDDEN) {
            let mut style = 0;
            if flags.contains(Flags::BOLD) {
                style |= STYLE_BOLD;
            }
            if flags.contains(Flags::ITALIC) {
                style |= STYLE_ITALIC;
            }
            let zw = cell.zerowidth().and_then(|z| z.first().copied());
            if let Some(g) = ctx.glyphs.get(GlyphKey { c, zw, style }) {
                let (mode, color) = if g.color {
                    (MODE_COLOR, [1.0, 1.0, 1.0, fg_alpha])
                } else {
                    (MODE_MASK, with_alpha(fg, fg_alpha))
                };
                ctx.fg.push(Quad {
                    rect: [x + g.left, y + g.top, g.uv[2], g.uv[3]],
                    uv: g.uv,
                    color,
                    clip,
                    params: [mode, 0.0, 0.0, 0.0],
                    color2: [0.0; 4],
                });
            }
        }

        if flags.intersects(Flags::ALL_UNDERLINES | Flags::STRIKEOUT) {
            let uc = cell.underline_color().map(|c| resolve(c, colors, pal)).unwrap_or(fg);
            let uc = with_alpha(uc, fg_alpha);
            let uy = (y + baseline + line_w * 1.5).min(y + ch - line_w);
            let w = cw * width;
            if flags.contains(Flags::UNDERCURL) {
                let h = (3.0 * s).round().max(3.0);
                ctx.fg.push(Quad {
                    rect: [x, uy - h * 0.5, w, h],
                    uv: [0.0; 4],
                    color: uc,
                    clip,
                    params: [MODE_UNDERCURL, line_w, 0.0, 0.0],
                    color2: [0.0; 4],
                });
            } else if flags.contains(Flags::DOUBLE_UNDERLINE) {
                ctx.fg.push(quad(Rect::new(x, uy - line_w, w, line_w), uc, clip, MODE_SOLID));
                ctx.fg.push(quad(Rect::new(x, uy + line_w, w, line_w), uc, clip, MODE_SOLID));
            } else if flags.intersects(Flags::DOTTED_UNDERLINE | Flags::DASHED_UNDERLINE) {
                let seg = if flags.contains(Flags::DOTTED_UNDERLINE) { line_w * 2.0 } else { cw * 0.5 };
                let mut sx = x;
                while sx < x + w {
                    ctx.fg.push(quad(Rect::new(sx, uy, (seg * 0.6).min(x + w - sx), line_w), uc, clip, MODE_SOLID));
                    sx += seg;
                }
            } else if flags.contains(Flags::UNDERLINE) {
                ctx.fg.push(quad(Rect::new(x, uy, w, line_w), uc, clip, MODE_SOLID));
            }
            if flags.contains(Flags::STRIKEOUT) {
                let sy = (y + baseline - ctx.glyphs.font_px * 0.3).round();
                ctx.fg.push(quad(Rect::new(x, sy, w, line_w), with_alpha(fg, fg_alpha), clip, MODE_SOLID));
            }
        }
    }

    // Search matches go under the text; the current one stands out.
    if let Some(search) = &pane.search {
        let others = with_alpha(pal.accent, 0.28 * o);
        let current = with_alpha(pal.ansi[3], 0.55 * o);
        for (i, m) in search.matches.iter().enumerate() {
            let row = m.line + offset as i32;
            if row < 0 || row as usize >= rows {
                continue;
            }
            let r = Rect::new(ox + m.start as f32 * cw, oy + row as f32 * ch, (m.end - m.start) as f32 * cw, ch);
            ctx.bg.push(quad(r, if i == search.current { current } else { others }, clip, MODE_SOLID));
        }
    }

    out.append(&mut ctx.bg);

    // Cursor: only in the focused pane.
    if show_cursor && ctx.focused {
        let cx = ox + cursor_px.0;
        let cy = oy + cursor_px.1;
        let thin = (1.6 * s).round().max(1.0);
        let ccol = pal.cursor;
        let a = ctx.cursor_alpha * o;
        match cursor.shape {
            CursorShape::Block => out.push(quad(Rect::new(cx, cy, cw, ch), with_alpha(ccol, a), clip, MODE_SOLID)),
            CursorShape::Beam => ctx.fg.push(quad(Rect::new(cx, cy, thin, ch), with_alpha(ccol, a), clip, MODE_SOLID)),
            CursorShape::Underline => {
                ctx.fg.push(quad(Rect::new(cx, cy + ch - thin, cw, thin), with_alpha(ccol, a), clip, MODE_SOLID))
            }
            _ => hollow(&mut ctx.fg, cx, cy, cw, ch, thin.min(1.0 * s).max(1.0), with_alpha(ccol, a), clip),
        }
    }

    // Underline the link under the mouse (Ctrl held).
    if let Some((line, c0, c1)) = pane.link {
        let row = line + offset as i32;
        if row >= 0 && (row as usize) < rows {
            let top = oy + row as f32 * ch;
            let uy = (top + baseline + line_w * 1.5).min(top + ch - line_w);
            let r = Rect::new(ox + c0 as f32 * cw, uy, (c1 - c0) as f32 * cw, line_w);
            ctx.fg.push(quad(r, with_alpha(pal.accent, o), clip, MODE_SOLID));
        }
    }

    out.append(&mut ctx.fg);

    if let Some(search) = &pane.search {
        draw_search_bar(ctx, search, card, o, out);
    }

    // Scrollbar while scrolled back.
    if offset > 0 && history > 0 {
        let track = Rect::new(card.right() - 6.0 * s, card.y + radius, 3.0 * s, card.h - 2.0 * radius);
        let total = (history + rows) as f32;
        let th = (rows as f32 / total * track.h).max(18.0 * s);
        let ty = track.y + (1.0 - offset as f32 / history as f32) * (track.h - th);
        out.push(Quad {
            rect: [track.x, ty, track.w, th],
            uv: [0.0; 4],
            color: with_alpha(pal.foreground, 0.28 * o),
            clip: NO_CLIP,
            params: [MODE_ROUNDED, track.w * 0.5, 0.0, 0.0],
            color2: [0.0; 4],
        });
    }

    if pane.claude {
        draw_claude_bar(ctx, pane, card, out);
    }

    draw_veil(ctx, card, focus, o, out);
    false
}

/// Dim unfocused panes with a veil of the surface color.
pub(super) fn draw_veil(ctx: &Ctx, card: Rect, focus: f32, o: f32, out: &mut Vec<Quad>) {
    let s = ctx.scale;
    let veil = (1.0 - focus) * 0.38 * ctx.multi * o;
    if veil > 0.002 {
        let v = card.inset(1.0 * s);
        out.push(Quad {
            rect: [v.x, v.y, v.w, v.h],
            uv: [0.0; 4],
            color: with_alpha(ctx.palette.surface, veil),
            clip: NO_CLIP,
            params: [MODE_ROUNDED, (ctx.config.radius * s - 1.0 * s).max(0.0), 0.0, 0.0],
            color2: [0.0; 4],
        });
    }
}

/// Shown over a pane while a file is dragged over the window.
pub(super) fn draw_drop_hint(ctx: &mut Ctx, pane: &Rect, out: &mut Vec<Quad>) {
    let s = ctx.scale;
    let pal = ctx.palette;
    let (cw, ch) = (ctx.glyphs.cell_w, ctx.glyphs.cell_h);
    let radius = ctx.config.radius * s;
    let frame = pane.inset(1.0 * s);
    out.push(rounded(
        frame,
        with_alpha(pal.accent, 0.12),
        radius,
        (2.0 * s).max(2.0),
        with_alpha(pal.accent, 0.9),
        NO_CLIP,
    ));
    let message = "Drop to type the path";
    let w = (message.chars().count() as f32 + 4.0) * cw;
    let pill = Rect::new(
        (pane.x + (pane.w - w) * 0.5).round(),
        (pane.y + (pane.h - ch * 2.0) * 0.5).round(),
        w,
        (ch * 2.0).round(),
    );
    out.push(rounded(
        pill,
        with_alpha(mix(pal.surface, pal.foreground, 0.07), 0.95),
        10.0 * s,
        s.max(1.0),
        with_alpha(pal.accent, 0.8),
        NO_CLIP,
    ));
    text(ctx, out, pill.x + 2.0 * cw, (pill.y + (pill.h - ch) * 0.5).round(), message, pal.foreground, 0, w, NO_CLIP);
}

/// The find bar, floating at the top right of a pane.
pub(super) fn draw_search_bar(ctx: &mut Ctx, search: &Search, card: Rect, o: f32, out: &mut Vec<Quad>) {
    let s = ctx.scale;
    let pal = ctx.palette;
    let (cw, ch) = (ctx.glyphs.cell_w, ctx.glyphs.cell_h);
    let h = (ch * 1.9).round();
    let w = (360.0 * s).min(card.w - 24.0 * s).max(cw * 16.0).min(card.w);
    let bar = Rect::new((card.right() - w - 12.0 * s).round(), (card.y + 10.0 * s).round(), w, h);

    let bg = mix(pal.surface, pal.foreground, 0.05);
    out.push(shadow(bar, 10.0 * s, 14.0 * s, 5.0 * s, 0.45 * o, ctx.alpha < 1.0));
    let border = with_alpha(mix(pal.border, pal.accent, 0.55), o);
    out.push(rounded(bar, with_alpha(bg, (ctx.alpha + 0.2).min(1.0) * o), 10.0 * s, s.max(1.0), border, NO_CLIP));

    let ty = (bar.y + (h - ch) * 0.5).round();
    let tx = bar.x + cw;
    text(ctx, out, tx, ty, "›", with_alpha(pal.accent, o), STYLE_BOLD, cw * 2.0, NO_CLIP);

    // Match counter on the right; red when nothing matches.
    let label = search.label();
    let label_w = label.chars().count() as f32 * cw;
    let label_color = if search.matches.is_empty() && !search.query.is_empty() {
        with_alpha(pal.ansi[1], o)
    } else {
        with_alpha(mix(pal.foreground, bg, 0.55), o)
    };
    text(ctx, out, bar.right() - cw - label_w, ty, &label, label_color, 0, label_w + 1.0, NO_CLIP);

    // The query, showing its end if it doesn't fit.
    let qx = tx + cw * 2.0;
    let room = (bar.right() - cw * 2.0 - label_w - qx).max(0.0);
    let max_chars = (room / cw).floor() as usize;
    let fg = with_alpha(pal.foreground, o);
    let caret_x = if search.query.is_empty() {
        let hint = with_alpha(mix(pal.foreground, bg, 0.7), o);
        text(ctx, out, qx, ty, "find in scrollback", hint, 0, room, NO_CLIP);
        qx - 3.0 * s
    } else {
        let chars: Vec<char> = search.query.chars().collect();
        let shown: String = chars[chars.len().saturating_sub(max_chars)..].iter().collect();
        qx + text(ctx, out, qx, ty, &shown, fg, 0, room + cw, NO_CLIP) + 1.0
    };
    let caret = Rect::new(caret_x, ty + ch * 0.12, (1.5 * s).round().max(1.0), ch * 0.76);
    out.push(quad(caret, with_alpha(pal.accent, o * ctx.cursor_alpha.max(0.25)), NO_CLIP, MODE_SOLID));
}

pub fn claude_bar_height(cell_h: f32, scale: f32) -> f32 {
    (cell_h * 1.6 + 6.0 * scale).round()
}

/// A piece of the usage bar.
pub(super) enum Part {
    Text(String, Rgba, u8),
    /// Percentage meter (0..100).
    Meter(f32),
    Gap,
}

/// Usage bar at the bottom of a Claude pane: model, context, 5-hour and weekly
/// limits with reset countdowns, and lines changed.
pub(super) fn draw_claude_bar(ctx: &mut Ctx, pane: &Pane, card: Rect, out: &mut Vec<Quad>) {
    let s = ctx.scale;
    let pal = ctx.palette;
    let o = pane.opacity;
    let (cw, ch) = (ctx.glyphs.cell_w, ctx.glyphs.cell_h);
    let pad = (ctx.config.padding * s).round();
    let bar_h = claude_bar_height(ch, s);
    let top = card.bottom() - bar_h;

    let muted = with_alpha(mix(pal.foreground, pal.surface, 0.5), o);
    let fg = with_alpha(mix(pal.foreground, pal.surface, 0.1), o);
    let level = |pct: f32| {
        let c = if pct < 60.0 {
            pal.ansi[2]
        } else if pct < 85.0 {
            pal.ansi[3]
        } else {
            pal.ansi[1]
        };
        with_alpha(c, o)
    };

    // Hairline separating the bar from Claude's output.
    let line = Rect::new(card.x + pad * 0.6, top, card.w - pad * 1.2, s.max(1.0));
    out.push(quad(line, with_alpha(mix(pal.border, pal.foreground, 0.04), o), NO_CLIP, MODE_SOLID));

    let status = pane.claude_status.clone().unwrap_or_default();
    let usage = ctx.usage.fresh();
    let five = status.five_hour.or(usage.five_hour);
    let week = status.seven_day.or(usage.seven_day);
    let model = if status.model.is_empty() { "claude".to_string() } else { status.model.to_lowercase() };

    let window = |label: &str, w: Option<claude::Window>| -> Vec<Part> {
        let mut parts = vec![Part::Text(format!("{label} "), muted, 0)];
        match w {
            Some(w) => {
                parts.push(Part::Meter(w.used_pct));
                parts.push(Part::Text(format!(" {:.0}%", w.used_pct), level(w.used_pct), 0));
                parts.push(Part::Text(format!(" resets {}", claude::until(w.resets_at)), muted, 0));
            }
            None => parts.push(Part::Text("—".into(), muted, 0)),
        }
        parts
    };
    let context = match status.context_pct {
        Some(p) => {
            vec![Part::Text("context ".into(), muted, 0), Part::Meter(p), Part::Text(format!(" {p:.0}%"), level(p), 0)]
        }
        None => vec![Part::Text("context —".into(), muted, 0)],
    };

    // Segments in priority order; trailing ones are dropped when the pane is narrow.
    let mut segments: Vec<Vec<Part>> =
        vec![vec![Part::Text("✻ ".into(), with_alpha(CLAUDE, o), STYLE_BOLD), Part::Text(model, fg, 0)]];
    if five.is_none() && week.is_none() {
        // Claude only reports plan usage with its replies; say so instead of showing empty meters.
        segments.push(vec![Part::Text("plan usage appears after Claude's first reply".into(), muted, 0)]);
    } else {
        segments.push(window("5h", five));
        segments.push(window("week", week));
    }
    segments.push(context);
    if status.lines_added + status.lines_removed > 0 {
        segments.push(vec![
            Part::Text(format!("+{}", status.lines_added), with_alpha(pal.ansi[2], o), 0),
            Part::Text(format!(" −{}", status.lines_removed), with_alpha(pal.ansi[1], o), 0),
        ]);
    }

    let meter_w = (cw * 5.0).round();
    let part_w = |p: &Part| match p {
        Part::Text(t, _, _) => t.chars().count() as f32 * cw,
        Part::Meter(_) => meter_w,
        Part::Gap => cw * 2.5,
    };
    let avail = card.w - 2.0 * pad;
    let mut used = 0.0;
    let mut parts: Vec<Part> = Vec::new();
    for seg in segments {
        let w: f32 = seg.iter().map(part_w).sum::<f32>() + if parts.is_empty() { 0.0 } else { cw * 2.5 };
        if used + w > avail {
            break;
        }
        used += w;
        if !parts.is_empty() {
            parts.push(Part::Gap);
        }
        parts.extend(seg);
    }

    let ty = (top + (bar_h - ch) * 0.5).round();
    let mut x = card.x + pad;
    for p in &parts {
        match p {
            Part::Text(t, c, style) => {
                text(ctx, out, x, ty, t, *c, *style, part_w(p) + 1.0, NO_CLIP);
            }
            Part::Meter(pct) => {
                let h = (4.0 * s).round().max(3.0);
                let my = (ty + (ch - h) * 0.5).round();
                let track = Rect::new(x, my, meter_w, h);
                out.push(rounded(
                    track,
                    with_alpha(mix(pal.surface, pal.foreground, 0.12), o),
                    h * 0.5,
                    0.0,
                    [0.0; 4],
                    NO_CLIP,
                ));
                let fw = (meter_w * (pct / 100.0).clamp(0.0, 1.0)).max(h);
                out.push(rounded(Rect::new(x, my, fw, h), level(*pct), h * 0.5, 0.0, [0.0; 4], NO_CLIP));
            }
            Part::Gap => {}
        }
        x += part_w(p);
    }
}