Format what today's chrome work left unformatted
`cargo fmt --check` was red on main in five files, all of them touched by
the Chrome and Outcome::Over work earlier today. This repo has no
pre-commit hook, so nothing caught it locally; makeover-immediate's
release preflight is what catches the same class, and only at publish
time.
- Co-Authored-By
- Claude Opus 5 (1M context) <noreply@anthropic.com>
5 files changed,
+38 insertions,
-13 deletions
| 424 |
424 |
|
// `Response` carries one, so an affordance available everywhere cannot
|
| 425 |
425 |
|
// be a fact about one answer.
|
| 426 |
426 |
|
let chrome = Chrome::new().bind("ctrl+k", "Search", Action::get("/palette"));
|
| 427 |
|
- |
assert_eq!(chrome.bound("ctrl+k").map(|b| b.label.as_str()), Some("Search"));
|
|
427 |
+ |
assert_eq!(
|
|
428 |
+ |
chrome.bound("ctrl+k").map(|b| b.label.as_str()),
|
|
429 |
+ |
Some("Search")
|
|
430 |
+ |
);
|
| 428 |
431 |
|
assert_eq!(
|
| 429 |
432 |
|
chrome.bound("ctrl+k").map(|b| &b.action),
|
| 430 |
433 |
|
Some(&Action::get("/palette"))
|
| 243 |
243 |
|
/// rather than fixed: a palette 4 rows from the edge of an 80x24 terminal
|
| 244 |
244 |
|
/// is a different thing from one 4 rows from the edge of a 200x60.
|
| 245 |
245 |
|
fn overlay_area(area: Rect) -> Rect {
|
| 246 |
|
- |
let pad_x = (area.width / 8).max(1).min(area.width.saturating_sub(2) / 2);
|
| 247 |
|
- |
let pad_y = (area.height / 8).max(1).min(area.height.saturating_sub(2) / 2);
|
|
246 |
+ |
let pad_x = (area.width / 8)
|
|
247 |
+ |
.max(1)
|
|
248 |
+ |
.min(area.width.saturating_sub(2) / 2);
|
|
249 |
+ |
let pad_y = (area.height / 8)
|
|
250 |
+ |
.max(1)
|
|
251 |
+ |
.min(area.height.saturating_sub(2) / 2);
|
| 248 |
252 |
|
Rect {
|
| 249 |
253 |
|
x: area.x + pad_x,
|
| 250 |
254 |
|
y: area.y + pad_y,
|
| 302 |
306 |
|
// binding naming a key no field can consume still lands.
|
| 303 |
307 |
|
if !self.editing() || !matches!(key, Key::Char(_)) {
|
| 304 |
308 |
|
let pressed = Self::key_name(key);
|
| 305 |
|
- |
if let Some(binding) = pressed
|
| 306 |
|
- |
.as_deref()
|
| 307 |
|
- |
.and_then(|name| self.chrome.bound(name))
|
| 308 |
|
- |
{
|
|
309 |
+ |
if let Some(binding) = pressed.as_deref().and_then(|name| self.chrome.bound(name)) {
|
| 309 |
310 |
|
return Self::call(&binding.action.clone());
|
| 310 |
311 |
|
}
|
| 311 |
312 |
|
}
|
| 1285 |
1285 |
|
// The regression a shared `View` would produce: the user's typing and the
|
| 1286 |
1286 |
|
// control they had walked to would come back changed, or not at all.
|
| 1287 |
1287 |
|
let mut runtime = Runtime::new(screen_of([
|
| 1288 |
|
- |
Node::Field(Box::new(Field::new(layout::FieldKind::Text, "title", "Title"))),
|
|
1288 |
+ |
Node::Field(Box::new(Field::new(
|
|
1289 |
+ |
layout::FieldKind::Text,
|
|
1290 |
+ |
"title",
|
|
1291 |
+ |
"Title",
|
|
1292 |
+ |
))),
|
| 1289 |
1293 |
|
Node::Act(Act::new("Save", Action::post("/save"))),
|
| 1290 |
1294 |
|
]));
|
| 1291 |
1295 |
|
runtime.key(Key::Char('h'));
|
| 72 |
72 |
|
out.push_str(OVERLAY_ID);
|
| 73 |
73 |
|
out.push('"');
|
| 74 |
74 |
|
|
| 75 |
|
- |
action_attrs(&binding.action, Fires::Key(&filter), None, morphs, None, out);
|
|
75 |
+ |
action_attrs(
|
|
76 |
+ |
&binding.action,
|
|
77 |
+ |
Fires::Key(&filter),
|
|
78 |
+ |
None,
|
|
79 |
+ |
morphs,
|
|
80 |
+ |
None,
|
|
81 |
+ |
out,
|
|
82 |
+ |
);
|
| 76 |
83 |
|
out.push_str("></button>");
|
| 77 |
84 |
|
}
|
| 78 |
85 |
|
|
| 199 |
206 |
|
|
| 200 |
207 |
|
#[test]
|
| 201 |
208 |
|
fn a_key_that_prints_nothing_is_named_the_way_the_dom_names_it() {
|
| 202 |
|
- |
assert!(trigger_filter("escape").expect("parsed").contains("'Escape'"));
|
|
209 |
+ |
assert!(
|
|
210 |
+ |
trigger_filter("escape")
|
|
211 |
+ |
.expect("parsed")
|
|
212 |
+ |
.contains("'Escape'")
|
|
213 |
+ |
);
|
| 203 |
214 |
|
assert!(
|
| 204 |
215 |
|
trigger_filter("arrowup")
|
| 205 |
216 |
|
.expect("parsed")
|
| 2598 |
2598 |
|
fn a_document_carries_the_apps_bindings_and_the_container_they_open_into() {
|
| 2599 |
2599 |
|
use quasi_router::Chrome;
|
| 2600 |
2600 |
|
|
| 2601 |
|
- |
let shell = Shell::default()
|
| 2602 |
|
- |
.with_chrome(Chrome::new().bind("ctrl+k", "Search", Action::get("/palette")));
|
|
2601 |
+ |
let shell = Shell::default().with_chrome(Chrome::new().bind(
|
|
2602 |
+ |
"ctrl+k",
|
|
2603 |
+ |
"Search",
|
|
2604 |
+ |
Action::get("/palette"),
|
|
2605 |
+ |
));
|
| 2603 |
2606 |
|
let html = Webview::new()
|
| 2604 |
2607 |
|
.with_shell(shell)
|
| 2605 |
2608 |
|
.screen(&Screen::list_detail("Tasks", false));
|
| 2609 |
2612 |
|
// After the content and before the body closes: chrome is the app's, so it
|
| 2610 |
2613 |
|
// sits outside what a screen's markup is.
|
| 2611 |
2614 |
|
let overlay_at = html.find("id=\"quasi-overlay\"").expect("emitted");
|
| 2612 |
|
- |
assert!(overlay_at > html.find("</main>").expect("main closes"), "{html}");
|
|
2615 |
+ |
assert!(
|
|
2616 |
+ |
overlay_at > html.find("</main>").expect("main closes"),
|
|
2617 |
+ |
"{html}"
|
|
2618 |
+ |
);
|
| 2613 |
2619 |
|
assert!(html.ends_with("</body></html>"), "{html}");
|
| 2614 |
2620 |
|
}
|
| 2615 |
2621 |
|
|