diff --git a/crates/hx-ai/src/claude_cli.rs b/crates/hx-ai/src/claude_cli.rs index 3b079e0..3911c65 100644 --- a/crates/hx-ai/src/claude_cli.rs +++ b/crates/hx-ai/src/claude_cli.rs @@ -484,6 +484,9 @@ mod tests { } tokio::time::sleep(std::time::Duration::from_millis(50)).await; } - panic!("child {pid} survived: {:?}", std::fs::read_to_string(format!("/proc/{pid}/stat"))); + panic!( + "child {pid} survived: {:?}", + std::fs::read_to_string(format!("/proc/{pid}/stat")) + ); } } diff --git a/crates/hx-core/src/subagent.rs b/crates/hx-core/src/subagent.rs index ffe3fd4..25d55f7 100644 --- a/crates/hx-core/src/subagent.rs +++ b/crates/hx-core/src/subagent.rs @@ -517,15 +517,16 @@ impl Tool for Task { spec_for(&self.kinds()) } async fn call(&self, a: Value, cx: &ToolCtx) -> ToolResult { - if a["prompt"].is_null() && a["prompts"].is_null() { - if let Some(w) = a["wait"].as_array() { - let ids: Vec = w - .iter() - .filter_map(|v| v.as_u64()) - .map(|n| n as usize) - .collect(); - return self.wait(&ids, cx).await; - } + if a["prompt"].is_null() + && a["prompts"].is_null() + && let Some(w) = a["wait"].as_array() + { + let ids: Vec = w + .iter() + .filter_map(|v| v.as_u64()) + .map(|n| n as usize) + .collect(); + return self.wait(&ids, cx).await; } if a["background"].as_bool() == Some(true) { let ps: Vec<&str> = match a["prompts"].as_array() { diff --git a/crates/hx-tui/src/lib.rs b/crates/hx-tui/src/lib.rs index 3841f86..1ee39f5 100644 --- a/crates/hx-tui/src/lib.rs +++ b/crates/hx-tui/src/lib.rs @@ -110,6 +110,12 @@ impl Hook for Forward { } } +type DocPrompt = ( + doc_view::DocView, + hx_core::Question, + tokio::sync::oneshot::Sender>>, +); + struct App { t: Transcript, ed: Editor, @@ -143,11 +149,7 @@ struct App { tokio::sync::oneshot::Sender, )>, review: Option, - doc: Option<( - doc_view::DocView, - hx_core::Question, - tokio::sync::oneshot::Sender>>, - )>, + doc: Option, probe: bool, kbd: bool, stats: Option<(hx_core::stats::Summary, String)>, @@ -967,7 +969,7 @@ fn chat_buf(app: &App) -> (Buffer, Vec) { .line_count(w) .max(1); cont.push(false); - cont.extend(std::iter::repeat(true).take(n - 1)); + cont.extend(std::iter::repeat_n(true, n - 1)); } let para = Paragraph::new(lines).wrap(Wrap { trim: false }); let r = Rect::new(0, 0, w, para.line_count(w) as u16); diff --git a/crates/hx-tui/src/markdown.rs b/crates/hx-tui/src/markdown.rs index fefb11c..8e903a0 100644 --- a/crates/hx-tui/src/markdown.rs +++ b/crates/hx-tui/src/markdown.rs @@ -234,9 +234,6 @@ impl W { self.text(" ", st); } else { self.flush(); - if self.lists.is_empty() { - return; - } } } Event::Rule => { diff --git a/crates/hx-tui/src/side.rs b/crates/hx-tui/src/side.rs index 4609bf8..0fb4b8e 100644 --- a/crates/hx-tui/src/side.rs +++ b/crates/hx-tui/src/side.rs @@ -365,9 +365,13 @@ fn lsp_card(c: &View) -> Vec> { if b.is_empty() { b.push(Line::styled("no servers started", th.dim())); } - let (errs, warns) = c.lens.diags.iter().fold((0, 0), |(e, w), d| { - if d.error { (e + 1, w) } else { (e, w + 1) } - }); + let (errs, warns) = + c.lens.diags.iter().fold( + (0, 0), + |(e, w), d| { + if d.error { (e + 1, w) } else { (e, w + 1) } + }, + ); if errs + warns > 0 { let mut ds = c.lens.diags.clone(); ds.sort_by_key(|d| (!d.error, d.file.clone(), d.line)); @@ -393,7 +397,10 @@ fn lsp_card(c: &View) -> Vec> { } let mut right = format!("{up}/{} ready", c.lens_lines.len()); if errs + warns > 0 { - right += &format!(" {} {}{errs} {}{warns}", th.sym.info, th.sym.err, th.sym.warn); + right += &format!( + " {} {}{errs} {}{warns}", + th.sym.info, th.sym.err, th.sym.warn + ); } let border = if bad || errs > 0 { th.err() @@ -544,7 +551,12 @@ mod tests { fn text(ls: &[Line]) -> String { ls.iter() - .map(|l| l.spans.iter().map(|s| s.content.as_ref()).collect::()) + .map(|l| { + l.spans + .iter() + .map(|s| s.content.as_ref()) + .collect::() + }) .collect::>() .join("\n") } @@ -625,7 +637,10 @@ mod tests { let s = text(&lines(&view(&st, &lens, &mcp, &log, 80))); assert!(s.contains("MCP") && s.contains("1/3 up"), "{s}"); assert!(s.contains("git") && s.contains("12 tools"), "{s}"); - assert!(s.contains("connection refused") && s.contains("connecting"), "{s}"); + assert!( + s.contains("connection refused") && s.contains("connecting"), + "{s}" + ); } #[test] @@ -651,12 +666,18 @@ mod tests { advising: true, consults: 2, last: Some((Duration::from_secs(7), Duration::from_secs(27))), - triggers: vec![("before a plan".into(), false), ("before done".into(), true)], + triggers: vec![ + ("before a plan".into(), false), + ("before done".into(), true), + ], }; v.consult = Some(&k); let s = text(&lines(&v)); assert!(s.contains("CONSULTANT") && s.contains("advising"), "{s}"); - assert!(s.contains("● before done") && s.contains("○ before a plan"), "{s}"); + assert!( + s.contains("● before done") && s.contains("○ before a plan"), + "{s}" + ); } #[test] @@ -667,6 +688,9 @@ mod tests { let tall = text(&lines(&view(&st, &lens, &[], &log, 80))); assert!(tall.contains("SESSION LOG"), "{tall}"); let short = text(&lines(&view(&st, &lens, &[], &log, 12))); - assert!(short.contains("MODEL") && !short.contains("SESSION LOG"), "{short}"); + assert!( + short.contains("MODEL") && !short.contains("SESSION LOG"), + "{short}" + ); } }