diff --git a/src/app/headless.rs b/src/app/headless.rs index 771bef0..96de8c2 100644 --- a/src/app/headless.rs +++ b/src/app/headless.rs @@ -122,6 +122,16 @@ impl Harness { self.pump(); } + /// Press on the element drawn for `key`, move the pointer by `(dx, dy)` and let go, as a mouse would. + fn drag(&mut self, key: &str, dx: f32, dy: f32) { + let (x, y) = self.rt.find(key).unwrap_or_else(|| panic!("{key} is not drawn")); + self.rt.pointer_move(x, y); + self.rt.pointer_down(x, y); + self.rt.pointer_move(x + dx, y + dy); + self.rt.pointer_up(x + dx, y + dy); + self.pump(); + } + fn press(&mut self, key: rune::Key, mods: impl FnOnce(&mut rune::Mods)) { let mut m = rune::Mods::default(); mods(&mut m); @@ -318,6 +328,24 @@ fn sessions_and_the_shell_panel() { h.settle(); } +/// The grips in the gutters answer the mouse: each panel follows its grip. +#[test] +fn the_sidebars_and_the_shell_resize_by_their_grips() { + let mut h = Harness::new(|_| vec![]); + let cwd = h.work.clone(); + h.step(|ws| ws.new_claude(cwd.clone())); + let id = h.ws().active.clone().unwrap(); + h.step(|ws| ws.toggle_shell(&id)); + h.settle(); + + h.drag("left-resize", 40.0, 0.0); + assert_eq!(h.ws().left_width(1600.0), SIDEBAR_W + 40.0, "the left sidebar follows its grip"); + h.drag("right-resize", -40.0, 0.0); + assert_eq!(h.ws().right_width(1600.0), RIGHT_MENU_W + 40.0, "the right sidebar follows its grip"); + h.drag("shell-resize", 0.0, -60.0); + assert_eq!(h.ws().shells[&id].height, SHELL_HEIGHT + 60.0, "the shell follows its grip"); +} + /// Cross-session tools are answered on the spot, and one that can't work says why. #[test] fn other_sessions_are_listed_started_and_read() { diff --git a/src/claude/mcp.rs b/src/claude/mcp.rs index 4becb29..58b3527 100644 --- a/src/claude/mcp.rs +++ b/src/claude/mcp.rs @@ -112,11 +112,11 @@ Claude Code session (the user says so, or you recognise it), find it with search call unlink_session when a link no longer fits. Both are silent."; /// What makes the model call `show_visual` (the tool's own description teaches the dialect, and stays deferred). -const VISUAL_INSTRUCTIONS: &str = " Visual: show_visual draws a card inside this terminal, under the call. Call it unasked \ -whenever a reply would contain a table, a comparison, three or more items that each have details, steps or a flow, an \ -architecture, a before/after, a status board or numbers worth a chart. A card is easier to read than the same thing typed \ -as text, and it is private and needs no approval. Put that part in the card and keep the typed reply to a few lines. A \ -short answer, a one-line fact or a code change needs no card."; +const VISUAL_INSTRUCTIONS: &str = " Visual: show_visual draws a card inside this terminal, under the call. Use it for the part \ +of a reply that is easier to see than to read: a table, a comparison, a flow, an architecture, a before/after, a status \ +board or numbers worth a chart. It is private and needs no approval, so call it unasked for that part. The answer stays \ +typed text: a card shows one part of it, never the whole reply, and most replies need none. Lists, explanations, short \ +answers and code changes stay in text."; const ARTIFACT_INSTRUCTIONS: &str = " Artifacts are for pages to share."; diff --git a/src/panels/inspector.rs b/src/panels/inspector.rs index 118b0e2..a554609 100644 --- a/src/panels/inspector.rs +++ b/src/panels/inspector.rs @@ -65,10 +65,11 @@ impl Workspace { .child(col().grow(1.0).shrink().min_h(0.0).w_full().child(p.view.render(width))), None => self.render_right_menu().key("right-menu").w(width).h_full().transition(Transition::opacity()), }; - // Both views can be resized by their left edge; a small grip sits in the gutter. + // Both views can be resized by their left edge; a small grip sits in the gutter. The gutter is the inner + // column's left padding: pinned any further left, the clipped sidebar hides the grip and its clicks. let handle = hbox() .key("right-resize") - .pin(Some(-(theme::PANEL_GAP / 2.0 + 3.0)), Some(0.0), None, Some(0.0)) + .pin(Some(theme::PANEL_GAP / 2.0 - 3.0), Some(0.0), None, Some(0.0)) .w(6.0) .center() .cursor(Cursor::ResizeColumn) diff --git a/src/panels/workspace_view.rs b/src/panels/workspace_view.rs index 6d58da8..726ed83 100644 --- a/src/panels/workspace_view.rs +++ b/src/panels/workspace_view.rs @@ -214,10 +214,11 @@ impl Workspace { let height = if p.open { p.height } else { 0.0 }; let key = crate::app::shell_key(&id); let focused = self.terminal_focused(&key); - // The top edge is the drag handle, with a small grip in the gutter. + // The top edge is the drag handle, with a small grip in the gutter. The gutter is the inner column's top + // padding: pinned any higher, the clipped slot hides the grip and its clicks. let handle = row() .key("shell-resize") - .pin(Some(0.0), Some(-(theme::PANEL_GAP / 2.0 + 3.0)), Some(0.0), None) + .pin(Some(0.0), Some(theme::PANEL_GAP / 2.0 - 3.0), Some(0.0), None) .h(6.0) .center() .cursor(Cursor::ResizeRow) diff --git a/src/visual/ui/mod.rs b/src/visual/ui/mod.rs index ce06595..2559ae9 100644 --- a/src/visual/ui/mod.rs +++ b/src/visual/ui/mod.rs @@ -11,7 +11,7 @@ const UI_TAGS: [&str; 4] = ["button", "chart", "details", "tabs"]; /// The description of the `show_visual` tool. Keep it in step with `parse::default_css` and the properties /// `Css::set` understands. -pub const PROMPT: &str = r#"Draws Markdown as a card inside the terminal, under this call. Use it when a reply needs a table, comparison, flow, architecture, before/after, status board, timeline, chart or mock-up, instead of typing that into the terminal. Each call adds a new card. The user sees the drawing and not the markup, so keep your normal reply short and say the key facts there without repeating the content. +pub const PROMPT: &str = r#"Draws Markdown as a card inside the terminal, under this call. Use it for the part of a reply that is clearer drawn than typed: a table, comparison, flow, architecture, before/after, status board, timeline, chart or mock-up. A card shows that part, not the whole answer; the rest of the reply stays typed text. Each call adds a new card. The user sees the drawing and not the markup, so say the key facts in your reply without repeating the card's content. `content` is ordinary Markdown (headings, lists, tables, code, links, emphasis). Where a drawing helps, put it in a fenced block with the info string `ui`; Markdown and `ui` blocks mix freely, with prose before and after and several blocks per call. The block holds HTML with inline CSS, and Claudiu draws it in the app's own dark style. There are no scripts; the interactive tags are listed below.