S013: lint, checks noted

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
astar76 2026-11-25 01:05:59 -06:00
commit 5ae8fd90e7
3 changed files with 7 additions and 7 deletions

View file

@ -62,7 +62,7 @@ impl<'a> Slider<'a> {
let r = self.handle(ui, whole.id.with("handle"), rect, rect, value);
let x = place(rect, &self.range, *value);
let f = feel(&r, self.live());
self.paint(ui, t, rect, whole.id, None, (x, f, &r), *value);
self.paint(ui, t, rect, None, (x, f, &r), *value);
r
}
@ -121,7 +121,7 @@ impl<'a> Slider<'a> {
}
/// `low` is the second handle of a range.
fn paint(&self, ui: &Ui, t: &Theme, rect: Rect, id: Id, low: Option<(f32, Feel, &Response, f64)>, high: (f32, Feel, &Response), value: f64) {
fn paint(&self, ui: &Ui, t: &Theme, rect: Rect, low: Option<(f32, Feel, &Response, f64)>, high: (f32, Feel, &Response), value: f64) {
let p = ui.painter();
let mid = rect.center().y;
let (on, off) = match (self.enabled, self.error) {
@ -165,7 +165,7 @@ impl<'a> Slider<'a> {
one(x, f, r, v);
}
one(hx, high.1, high.2, value);
if waiting(ui.ctx(), id, self.busy) {
if waiting(ui.ctx(), high.2.id, self.busy) {
spinner(p, pos2(rect.right() - TRACK / 2.0, mid), TRACK - 2.0, t.on_secondary_container);
}
}
@ -187,7 +187,7 @@ pub fn range(ui: &mut Ui, t: &Theme, slider: Slider, low: &mut f64, high: &mut f
*high = high.max(*low);
let (fa, fb) = (feel(&a, slider.live()), feel(&b, slider.live()));
let (xa, xb) = (place(rect, &slider.range, *low), place(rect, &slider.range, *high));
slider.paint(ui, t, rect, whole.id, Some((xa, fa, &a, *low)), (xb, fb, &b), *high);
slider.paint(ui, t, rect, Some((xa, fa, &a, *low)), (xb, fb, &b), *high);
a.changed() || b.changed()
}

View file

@ -434,7 +434,7 @@ fn dialog_harness() -> H {
let answer = d.show(ui.ctx(), t, s.open, |ui| {
Field::new("Link").clear().show(ui, t, &mut s.text);
let options = ["One", "Two"].map(String::from);
Combo::new("Queue", &options, 200.0).show(ui, t, &mut s.rects.len().min(0));
Combo::new("Queue", &options, 200.0).show(ui, t, &mut 0);
});
if let Some(a) = answer {
s.open = false;

View file

@ -46,7 +46,7 @@ Not done: a Content-Length smaller than the real body, on a server without range
## S013 — Controls, dialogs and toasts (2026-11-25)
Done: `crates/app/src/ui/{widgets/,field,menu,dialog,toast,gallery}`; `medlar --gallery` shows every control.
Verified: `nice cargo test -j 2 -p medlar --test widgets` green (23: hover, press, keyboard, focus return, popups inside the window); shots of every control seen in light or dark and at 480×360; hover or press seen on a sample (buttons, icon buttons, group, segments, chips, range, menu).
Verified: `nice cargo test -j 2 -p medlar --test widgets` green (23: hover, press, keyboard, focus return, popups inside the window); shots of every control seen in light or dark, hovered, and at 480×360; press seen on buttons, group, chips.
All take `(ui, &Theme, …)`; the theme is `app.theme.clone()`. The caller keeps every value.
- `widgets`: `Button::new(text)` / `Button::icon(icon, name)` `.with_icon .kind(Kind) .size(Size) .danger .enabled .busy .toggle(on) .tip .keys .width .show`; `group(name, [(icon, text)], &mut chosen)`, `segmented(…same…)`, `tabs(name, &[Tab], &mut chosen)`, `split(icon, text, more, open) -> (main, arrow)`, `Fab{icon,text,name,keys}`, `fab_menu(ctx, t, id, corner, (name, close), &mut open, items)`, `toolbar(ctx, t, id, bottom middle, open, add)`.
- `Choice::new(label)` `.enabled .busy .error .mixed` then `.switch/.checkbox(&mut on)` or `.radio(on)`; `Chip::new(text).icon .filter(on) .closable .error`; `Slider::new(name, range, step).show_value(&fn)`, `range(slider, &mut low, &mut high)`; `tip`, `waiting`, `spinner`, `ring`, `feel`, `line`.
@ -54,7 +54,7 @@ All take `(ui, &Theme, …)`; the theme is `app.theme.clone()`. The caller keeps
- `menu`: `Item::new(text, action) .icon .keys .checked .danger .enabled`, `Item::sub`, `Item::line`; `menu::below(ui, t, &response, || items)`, `menu::context(…)` give back the action. `menu::is_open`, `any_open`.
- `dialog`: `Dialog::new(id, title, main)` `.body .width(size::DIALOG_*) .enabled .busy`, `Dialog::confirm(…, danger)`; `.show(ctx, t, open, content) -> Option<Answer>` every frame, the caller sets `open`. `sheet(ctx, t, id, title, open, content) -> close?`. View shortcuts wait while `dialog::any_open` or `menu::any_open`.
- `toast`: `Toasts<A>` `.info .error .action .undo`, `.show(ctx, t, bottom) -> Option<A>`.
Not done: menus close without a fade; tooltips show on hover only, not on keyboard focus; screen readers untested. Gallery words are not in the catalogue (builders only).
Not done: menus close without a fade; tooltips show on hover only, not on keyboard focus; screen readers untested. Gallery words are not in the catalogue (builders only). Hidden release run of `--gallery`: 4 pages and a menu by real clicks, idle 5 s = 0.00 % CPU. The debug build opened no window in `tools/hidden.sh` (nested niri drops the connection, no panic; also without `--gallery`); the release build does. Cause not found.
## Later
-