The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.
TypeScript 3d-modelingagent-frameworkagent-harnessai-agentscadclaude-codecodexcoding-agentsdeveloper-toolsesp32game-developmentmcp-servermulti-agentopen-hardwareopencodeopenharnesspcbroboticsterminaltmux
fix(hn): frame filled panes and keep narrow headings readable (#471)
Dee7debeb1750fb
diff --git a/docs/research/2026-09-29-hn-pane-ui-columns.png b/docs/research/2026-09-29-hn-pane-ui-columns.pngindex 0c3cbe555..4da0dc5d5 100644Binary files a/docs/research/2026-09-29-hn-pane-ui-columns.png and b/docs/research/2026-09-29-hn-pane-ui-columns.png differdiff --git a/docs/research/2026-09-29-hn-pane-ui-light.png b/docs/research/2026-09-29-hn-pane-ui-light.pngindex d4ab44a81..47af5f996 100644Binary files a/docs/research/2026-09-29-hn-pane-ui-light.png and b/docs/research/2026-09-29-hn-pane-ui-light.png differdiff --git a/docs/research/2026-09-29-hn-pane-ui-rows.png b/docs/research/2026-09-29-hn-pane-ui-rows.pngindex c5ac6deb9..55186b04c 100644Binary files a/docs/research/2026-09-29-hn-pane-ui-rows.png and b/docs/research/2026-09-29-hn-pane-ui-rows.png differdiff --git a/docs/research/2026-09-29-hn-pane-ui.md b/docs/research/2026-09-29-hn-pane-ui.mdindex 82371713d..9776382ab 100644--- a/docs/research/2026-09-29-hn-pane-ui.md+++ b/docs/research/2026-09-29-hn-pane-ui.md@@ -1,10 +1,14 @@# hn pane surfaceshn now presents terminal panes as quiet surfaces with space between them. Each pane has-an integrated title, a thin outline around the focused pane, and inset content. The status line stays+an integrated title, its own outline, and inset content. Focus uses a thin, bright border;+the other outlines stay thin and muted. The status line staysat the bottom in muted green, with tabs ordered `number:name* status`. Pane headers put thename before the state too: `hn ⋮` on the left, with `project ⑂ branch #123` aligned to the-right. Quota text is compact: `Claude 100%`, with amber or red only on the percentage. The branch appears only in pane headers; the+right. Long names shorten in the middle so their state and distinguishing suffix remain visible.+Watcher details shorten when needed; raw `pane_title` values stay complete.+Quota text is compact: `Claude 100%`, with amber or red only on the percentage. The branch+appears only in pane headers; thebottom right keeps the familiar `machine:folder` location cue. Status-bar groups have two spacesbetween them. Working and waiting indicators remain visible; idle dots are hidden in tabs andpane headers. Attention markers, prefix cues, inbox rows, connection notices, preview counters@@ -39,25 +43,32 @@ At normal sizes there is a one-cell gap around the pane surfaces and between adjone column of content padding on each side, and vertical padding where space permits. Smallpanes automatically give these cells back to the program. A one-cell terminal remains responsiveand survives resizing.-The focused pane keeps the terminal's native background and full text contrast, including-padding and the cells behind its thin border. A black terminal stays black right to the outline. Other panes-use `rgb(64, 64, 64)` surfaces in dark terminals, with softer text so focus reads across the-whole pane. The backdrop also fills outer padding and gaps, stopping at the status bar.-Light terminals retain their light surface counterpart. A lone or zoomed pane uses its own-background throughout, without a focus outline. In a split layout, the focused pane has a thin-outline in the existing gutter cells, which follows keyboard or mouse focus without shrinking-program content or changing its mouse coordinates. Compact panes keep their usable cells.-Surface colors follow the terminal's native light/dark theme and update when it changes. The-daemon receives the surface colors so its programs agree with their surrounding padding.-Program ANSI foregrounds, backgrounds and attributes remain intact; only default colors inherit-the pane surface palette. Explicit user styles and title formats still override the defaults.+The focused pane keeps the terminal's native background and full text contrast throughout+its filled interior and border cells, so there is no canvas-colored strip inside the outline.+The terminal draws the thin line within its character cell; its pane-colored background fills+that whole cell. Other panes use `rgb(64, 64, 64)` surfaces in dark+terminals, with softer text. Each pane owns a complete outline inside its tile; a dark one-cell+gap separates neighboring outlines. All outlines use thin box-drawing characters. The focused outline uses a brighter neutral+color; inactive outlines use a muted gray. Explicit+border styles and line choices override these defaults. The bottom status bar keeps its own+color.++Light terminals retain a light surface counterpart. A lone or zoomed pane uses its own+background throughout, without a focus outline. Focus changes alter border color+without resizing program content or changing its mouse coordinates. Compact panes give border+and padding cells back to the program. Surface colors follow the terminal's native light/dark+theme and update when it changes. The daemon receives those colors so its programs agree with+their surrounding padding. Program ANSI foregrounds, backgrounds and attributes remain intact;+only default colors inherit the pane surface palette. Explicit title formats still override the+default heading. `pane_heading` fits the displayed name, state and watcher label to the title+row; scripts and custom formats can continue using the complete `pane_title`.The default is `set -g @hn-look panes`. `set -g @hn-look classic` selects the previous hn lineborders. `set -g @hn-look tmux` selects tmux's appearance and unpadded content geometry. Switching applies immediately without recreating panes or changing the layout.## Verification-The release build passes 149 Rust tests, including rectangle containment and usable minimum+The release build passes 150 Rust tests, including rectangle containment and usable minimumsizes, adjacent surfaces, user style overrides, light/dark contrast, foreground inference andmalformed OSC color replies. The new `tui/tests/pane-ui.py`exercises the running application with actual keys and SGR mouse input:@@ -66,7 +77,8 @@ exercises the running application with actual keys and SGR mouse input:- All seven layouts and eight position targets with top, bottom and disabled pane titles.- Identical split structure across appearances, including percentage splits on both axes.- Application mouse coordinates after padding and after adding two status rows at the top.-- Whole-pane focus contrast through keyboard and mouse selection, including gutters and outer padding.+- Independent outlines, dark gutters, exact border colors, and focus brightness through keyboard and mouse selection.+- Explicit border colors and line styles, and long titles retaining their suffix and waiting mark.- Borderless single and zoomed panes, right-aligned branch context, and hidden idle indicators.- Live light/dark theme changes, custom style overrides in active and inactive panes, and reported option defaults.- Explicit program foreground/background colors; 80x24, 24x8, 6x4 and 1x1 terminals.diff --git a/tui/README.md b/tui/README.mdindex 324ef4efb..d8ec3f4e8 100644--- a/tui/README.md+++ b/tui/README.md@@ -71,12 +71,13 @@ never a tmux server you have running.Splits, `resize-pane`, the seven layouts, `swap-pane`, `rotate-window`, `join-pane`, `break-pane`and `select-pane` are tmux 3.5a's own arithmetic (layout.c, window.c): the same split sizes, the samepane numbers and the same active pane after each. hn draws these layouts as pane surfaces-with one-cell gaps, inset terminal content and a thin outline around the focused pane. The-surfaces follow the terminal's light/dark theme: the focused pane keeps full contrast and-its background extends through the padding to the thin border;-inactive dark panes use `rgb(64, 64, 64)` with softer text. This backdrop fills the padding-and gaps up to the status bar. A lone or zoomed pane has no focus outline or gray surround.-Light terminals keep a light counterpart.+with one-cell gaps, inset terminal content and an outline around each pane. The focused+outline is thin and bright; other outlines are equally thin and muted. The surfaces follow the+terminal's light/dark theme: focus keeps the native background throughout the filled interior.+Border cells share the pane background, so the fill reaches the outline without an inner gap.+Inactive dark panes use `rgb(64, 64, 64)` with softer text, separated by dark gaps.+A lone or zoomed pane has no focus outline or gray surround. Light terminals keep a light+counterpart. Explicit border colors and line choices override the automatic appearance.Explicit program colors and user styles stay intact. The muted green status bar has a continuousbackground, with tabs ordered `number:name* status` (previous window: `number:name- status`).Quota warnings read `Claude 100%`, with amber or red only on the percentage. Padding@@ -85,7 +86,8 @@ coordinates, copy selection and PTY dimensions follow the inset content. `windowthe original split structure. Use `set -g @hn-animations off` to keepworking and loading indicators still. Some defaults differ, and your `.tmux.conf`overrides each: `pane-border-status top` (each pane's title row: its harness's name and state, and-its project and branch where the pane has room), `allow-set-title off` (a pane's title is its+its project and branch where the pane has room; long names shorten in the middle to keep+the state and distinguishing suffix visible), `allow-set-title off` (a pane's title is itsharness's name, not what the program sets), `history-limit 10000` (agents print a lot; tmux keeps2000), `mouse on`, `set-titles on` (the terminal's title: `?2 Fix flaky login test — Harness`, theharnesses waiting on you and the one in front; `set-titles-string` changes it), and the status line:@@ -159,14 +161,14 @@ pane counts as done and unread (`✓`) until you go to that pane.| `⠹` (turning) | working || `?` | needs you: a question or a permission || `✓` | done, and you haven't looked yet |-| `·` | idle |+| `·` | idle in lists; hidden in pane headers and tabs || `✗` | failed || `◌` `‖` `○` | starting, paused, offline |-- **The status line** counts the whole fleet: `?2 ✗1 ✓5 ⠹41` means two need you (reversed), one- failed, five are done and unread, and 41 are working. Idle ones aren't counted, and a state with- none drops out. The right side also shows the focused pane's machine, project and branch (only the- branch below 110 columns), so the window list keeps its room at 80.+- **The status line** counts the whole fleet: `?2 ✗1 ✓5 ⠹41` means two need you, one failed,+ five are done and unread, and 41 are working. Idle ones aren't counted, and a state with none+ drops out. The right side keeps the focused pane's `machine:folder` and the clock, with two+ spaces between groups. Branch and pull request context stay in the pane header.- **`C-b s`** lists every harness, the most urgent nearest the prompt: needs you, failed, done andunread, working, then the rest. Each row has one line: the question, what it is doing now(`Run the unit tests`, from its tool calls), what its last turn came to (the daemon's recap, else@@ -204,7 +206,8 @@ For your own formats: `#{fleet}` (the status line's counts, ready to drop into y`#{fleet_needs}` `#{fleet_failed}` `#{fleet_done}` `#{fleet_working}` `#{fleet_idle}`, `#{spinner}`,`#{pane_agent_icon}` and `#{pane_agent_state}` (needs, working, done, idle, starting, failed,paused, offline), `#{pane_agent_mark}` (the icon in its colour, as the title row draws it),-`#{window_agent_icon}` and `#{window_agent_state}` (its most urgent pane's), `#{pane_project}`,+`#{pane_heading}` (the name, state and watcher label fitted to the pane header; `#{pane_title}`+stays complete), `#{window_agent_icon}` and `#{window_agent_state}` (its most urgent pane's), `#{pane_project}`,`#{pane_branch}`, `#{pane_where}` (`project ⑂ branch #123` as far as it fits beside the title),`#{pane_pr}` `#{pane_pr_state}` `#{pane_pr_url}` (the pull request for its branch), `#{pane_tokens}`and `#{fleet_tokens}` (what it, and all of them, have used: `1.2M`), `#{pane_lines}` (`+340 −52`),diff --git a/tui/src/format.rs b/tui/src/format.rsindex b2ccdeca9..e0413264a 100644--- a/tui/src/format.rs+++ b/tui/src/format.rs@@ -1038,6 +1038,74 @@ pub fn pane_title(app: &App, window: usize, pane: u64) -> String {agent.map(|a| a.name.clone()).or_else(|| p.fg_command.clone()).unwrap_or_else(|| if p.machine_id == app.fleet.local_id { crate::app::full_hostname() } else { app.fleet.machine_name(&p.machine_id) })}+/// Keep a distinguishing suffix, such as "(3)", visible when a title is long.+pub fn clip_middle(text: &str, cols: usize) -> String {+ use unicode_segmentation::UnicodeSegmentation;+ use unicode_width::UnicodeWidthStr;+ if text.width() <= cols { return text.to_string() }+ if cols == 0 { return String::new() }+ let left_room = cols / 2;+ let right_room = cols - 1 - left_room;+ let mut left = String::new();+ for g in text.graphemes(true) {+ if left.width() + g.width() > left_room { break }+ left.push_str(g);+ }+ let mut right = Vec::new();+ let mut width = 0;+ for g in text.graphemes(true).rev() {+ if width + g.width() > right_room { break }+ right.push(g);+ width += g.width();+ }+ format!("{}…{}", left.trim_end(), right.into_iter().rev().collect::<String>().trim_start())+}++/// Columns available to pane-border-format inside its frame.+fn pane_heading_columns(app: &App, window: usize, pane: u64) -> usize {+ if app.options.pane_look() {+ let Some(tab) = app.tabs.get(window) else { return 0 };+ let Some(tile) = tab_rect(app, window, pane) else { return 0 };+ crate::pane_frame::frame(tile, app.window_area(tab), app.pane_status(tab)).title+ .map(|r| r.width.saturating_sub(2) as usize).unwrap_or(0)+ } else {+ content_rect(app, window, pane).map(|r| r.width.saturating_sub(4) as usize).unwrap_or(0)+ }+}++fn pane_heading(app: &App, window: usize, pane: u64) -> String {+ let watcher = app.panes.get(&pane).and_then(|p| match &p.phase {+ crate::pane::Phase::Watching(who) => Some(who.as_str()), _ => None,+ });+ compact_pane_heading(&pane_title(app, window, pane), app.pane_state(pane), watcher,+ pane_heading_columns(app, window, pane).saturating_sub(1), app.tick)+}++/// Keep state visible after the name. Watcher detail yields before the pane's identity;+/// a narrow title keeps both ends, so otherwise identical tasks retain their suffixes.+fn compact_pane_heading(title: &str, state: Option<crate::fleet::State>, watcher: Option<&str>, columns: usize, tick: u64) -> String {+ use unicode_width::UnicodeWidthStr;+ let mark = state.filter(|s| *s != crate::fleet::State::Ready).map(|s| agent_mark(s, tick)).unwrap_or_default();+ let mark_width = crate::draw::format_width(&mark);+ if columns <= mark_width { return if columns == mark_width { mark } else { String::new() } }+ let state_room = if mark.is_empty() { 0 } else { mark_width + 1 };+ let available = columns.saturating_sub(state_room);+ let full_watch = watcher.map(|who| if who.is_empty() { "[watching]".to_string() } else { format!("[watching — {who} has it]") });+ let watch = full_watch.map(|full| {+ if full.width() + 1 <= available.saturating_sub(title.width().min(12)) { full }+ else if "[watching]".width() + 1 <= available.saturating_sub(title.width().min(4)) { "[watching]".to_string() }+ else { String::new() }+ }).unwrap_or_default();+ let watch_room = if watch.is_empty() { 0 } else { watch.width() + 1 };+ let mut out = clip_middle(title, available.saturating_sub(watch_room));+ if !mark.is_empty() { if !out.is_empty() { out.push(' ') } out.push_str(&mark) }+ if !watch.is_empty() {+ if !out.is_empty() { out.push(' ') }+ out.push_str(&format!("#[fg=yellow]{watch}#[fg=default]"));+ }+ out+}+/// The pane's own cells, from its window's top-left corner: tmux's pane_left/top/width/height./// The clients showing the session in front: this one (not hn with no terminal, nor while a/// command has another session in front) and those showing it as this one has it — or, for a@@ -1115,6 +1183,7 @@ fn table(app: &App, name: &str, window: usize, pane_id: Option<u64>) -> Option<V"pane_active" => (focus == tab.and_then(|t| t.focus)).then_some("1").unwrap_or("0").into(),"pane_index" => focus.and_then(|f| tab.and_then(|t| t.panes().iter().position(|p| *p == f))).map(|i| (i + app.pane_base(window)).to_string()).unwrap_or_default(),"pane_title" => focus.map(|f| pane_title(app, window, f)).unwrap_or_else(|| host.clone()),+ "pane_heading" => focus.map(|f| pane_heading(app, window, f)).unwrap_or_default(),"pane_id" => focus.map(crate::pane::tag).unwrap_or_default(),// What tmux on the pane's machine says (terminal_info), then what the shell said (OSC 7),// then where the harness started.@@ -1226,21 +1295,19 @@ fn table(app: &App, name: &str, window: usize, pane_id: Option<u64>) -> Option<V// no git shows its name."pane_where" => pane.zip(agent).and_then(|(p, a)| {if a.branch.is_empty() && a.project.is_empty() { return None }- let room = content_rect(app, window, p.id)?.width.saturating_sub(4) as usize;+ let room = pane_heading_columns(app, window, p.id);let width = |s: &str| unicode_width::UnicodeWidthStr::width(s);- let mut left = 1 + width(&pane_title(app, window, p.id)) + 1;- if app.pane_state(p.id).is_some() { left += 2 }- if let crate::pane::Phase::Watching(who) = &p.phase { left += width(" [watching]") + if who.is_empty() { 0 } else { width(&format!(" — {who} has it")) } }+ let left = 1 + crate::draw::format_width(&pane_heading(app, window, p.id));let pr = a.pr.as_ref().map(|p| format!(" {}", p.label())).unwrap_or_default();// A pane on another machine says which (scp's way: gpu-box:ml-lab).let far = (p.machine_id != app.fleet.local_id && !a.project.is_empty()).then(|| format!("{}:", app.fleet.machine_name(&p.machine_id))).filter(|m| m.len() > 1);let far_project = far.as_ref().map(|m| format!("{m}{}", a.project));// A folder that is not a git repository: its name alone (and the machine's).- if a.branch.is_empty() { return [far_project, Some(a.project.clone())].into_iter().flatten().find(|c| room >= left + width(c) + 2 + 4) }+ if a.branch.is_empty() { return [far_project, Some(a.project.clone())].into_iter().flatten().find(|c| room >= left + width(c) + 3) }[far_project.as_ref().filter(|_| !pr.is_empty()).map(|fp| format!("{fp} ⑂ {}{pr}", a.branch)), far_project.as_ref().map(|fp| format!("{fp} ⑂ {}", a.branch)),(!a.project.is_empty() && !pr.is_empty()).then(|| format!("{} ⑂ {}{pr}", a.project, a.branch)), (!a.project.is_empty()).then(|| format!("{} ⑂ {}", a.project, a.branch)),(!pr.is_empty()).then(|| format!("⑂ {}{pr}", a.branch)), Some(format!("⑂ {}", a.branch)), Some(a.branch.clone())]- .into_iter().flatten().find(|c| room >= left + width(c) + 2 + 4)+ .into_iter().flatten().find(|c| room >= left + width(c) + 3)}).unwrap_or_default(),// A pane's harness at a glance, as its title shows it (empty for a plain shell), and what it// works on; a window's most urgent harness state, as the window list shows it.@@ -1563,6 +1630,30 @@ fn restyle(mut style: Style, base: Style, spec: &str) -> Style {#[cfg(test)]mod tests {+ #[test]+ fn compact_headings_reserve_state_and_keep_names_distinct() {+ use crate::fleet::State;+ let title = "Investigate checkout failures across browser versions (2)";+ let header = super::compact_pane_heading(title, Some(State::NeedsInput), None, 32, 0);+ assert!(header.starts_with("Investigate"), "{header}");+ assert!(header.contains("(2) ") && header.contains('?'), "{header}");+ assert!(header.contains('…'));+ assert_eq!(crate::draw::format_width(&header), 32);+ assert_eq!(super::compact_pane_heading("Idle", Some(State::Ready), None, 20, 0), "Idle");+ for name in [title, "日本語の長いタスクを確認する (3)", "Cafe\u{301} checkout investigation (4)"] {+ for columns in 0..80 {+ let header = super::compact_pane_heading(name, Some(State::NeedsInput), Some("another terminal"), columns, 0);+ assert!(crate::draw::format_width(&header) <= columns, "{columns}: {header}");+ assert_eq!(header.contains('?'), columns > 0, "{columns}: {header}");+ assert_eq!(header.contains("[watching"), header.contains("watching]") || header.contains("has it]"));+ }+ }+ let compact = super::compact_pane_heading(title, Some(State::NeedsInput), Some("another terminal"), 32, 0);+ assert!(compact.contains("[watching]") && !compact.contains("another terminal"));+ let wide = super::compact_pane_heading("Review", None, Some("another terminal"), 80, 0);+ assert!(wide.contains("[watching — another terminal has it]"));+ }+#[test]fn quota_warning_marks_only_high_usage_without_reversing_text() {let mut u = crate::fleet::Usage { provider: "claude".into(), account: None,diff --git a/tui/src/options/mod.rs b/tui/src/options/mod.rsindex 4fc1cea7d..858ecbb40 100644--- a/tui/src/options/mod.rs+++ b/tui/src/options/mod.rs@@ -92,7 +92,7 @@ pub fn defaults() -> &'static BTreeMap<String, String> {// Each pane's title row: the harness's name, then its state symbol, [watching — who// has it] when another window has the pane to type in, and its project and branch// where there is room. Git context stays here; the status bar keeps the location cue.- m.insert("pane-border-format".into(), " #{pane_title}#{?#{==:#{pane_agent_state},idle},,#{?pane_agent_icon, #{pane_agent_mark},}}#{?pane_watched, #[fg=yellow][watching#{?pane_watcher, — #{pane_watcher} has it,}]#[fg=default],}#{?pane_where,#[align=right] #[dim]#{pane_where} #[nodim],}".into());+ m.insert("pane-border-format".into(), " #{pane_heading}#{?pane_where,#[align=right] #[dim]#{pane_where} #[nodim],}".into());// Session and window navigation on the left; connection, quota, fleet, location and// clock on the right. A leading space keeps a full window list from running into it.m.insert("status-left".into(), "#{?client_prefix,#[bold],}[#{session_name}]#{?client_prefix, ›#[nobold],} ".into());@@ -154,8 +154,8 @@ fn pane_default(name: &str) -> Option<String> {Some(match name {"window-style" => pair(p.inactive_foreground, p.inactive_surface),"window-active-style" => pair(p.foreground, p.surface),- "pane-border-style" => pair(p.muted, p.header),- "pane-active-border-style" => pair(p.active_foreground, p.active_header),+ "pane-border-style" => pair(p.border, p.inactive_surface),+ "pane-active-border-style" => pair(p.active_border, p.surface),"status-style" | "window-status-style" => pair(p.status_foreground, p.status),"window-status-current-style" => format!("{},bold", pair(p.status_foreground, p.status)),"window-status-separator" => " ".into(),@@ -273,6 +273,13 @@ impl Store {layers.into_iter().flatten().find_map(|m| m.get(name).cloned()).or_else(|| self.default_of(name, inherit_window_style))}+ /// Whether a pane/window style or line setting was explicitly chosen at any inherited layer.+ pub fn has_window_override(&self, name: &str, window: &str, pane: u64) -> bool {+ self.panes.get(&pane).is_some_and(|m| m.contains_key(name))+ || self.windows.get(window).is_some_and(|m| m.contains_key(name))+ || self.global_window.contains_key(name)+ }+/// As tmux's formats read it (options_to_string, numeric): a flag is 1 or 0; an array its items/// joined by spaces.pub fn format_value(&self, name: &str, window: &str, pane: Option<u64>) -> Option<String> {diff --git a/tui/src/pane_frame.rs b/tui/src/pane_frame.rsindex 4dc27bed0..6aad6270b 100644--- a/tui/src/pane_frame.rs+++ b/tui/src/pane_frame.rs@@ -8,18 +8,25 @@ use crate::layout::Status;pub struct Frame { pub surface: Rect, pub content: Rect, pub title: Option<Rect>, pub outline: Option<Rect> }pub fn frame(tile: Rect, canvas: Rect, status: Status) -> Frame {- let mut surface = tile;+ let mut outer = tile;// A small pane gives its cells to the program. Larger panes keep one-cell outer space.if tile.width >= 12 && canvas.width >= 40 {- if tile.x == canvas.x { surface.x += 1; surface.width -= 1; }- if tile.right() == canvas.right() { surface.width = surface.width.saturating_sub(1); }+ if tile.x == canvas.x { outer.x += 1; outer.width -= 1; }+ if tile.right() == canvas.right() { outer.width = outer.width.saturating_sub(1); }}if tile.height >= 8 && canvas.height >= 12 {// With top/bottom status, tmux borrows the divider row for a pane title. Leave// that row as a gutter and draw the title inside the surface instead.- if tile.y == canvas.y || status == Status::Top { surface.y += 1; surface.height -= 1; }- if tile.bottom() == canvas.bottom() || status == Status::Bottom { surface.height = surface.height.saturating_sub(1); }+ if tile.y == canvas.y || status == Status::Top { outer.y += 1; outer.height -= 1; }+ if tile.bottom() == canvas.bottom() || status == Status::Bottom { outer.height = outer.height.saturating_sub(1); }}+ // Each normal-sized tile owns its outline; the layout's divider remains a gap.+ // A lone or zoomed pane, and compact panes, keep their content space instead.+ let outline = (tile != canvas && tile.width >= 12 && canvas.width >= 40+ && tile.height >= 8 && canvas.height >= 12).then_some(outer);+ let surface = if outline.is_some() {+ Rect::new(outer.x + 1, outer.y + 1, outer.width - 2, outer.height - 2)+ } else { outer };let title = (surface.height > 1 && status != Status::Off).then(|| Rect::new(surface.x,if status == Status::Bottom { surface.bottom() - 1 } else { surface.y }, surface.width, 1));let mut content = surface;@@ -29,12 +36,6 @@ pub fn frame(tile: Rect, canvas: Rect, status: Status) -> Frame {}if content.width >= 12 { content.x += 1; content.width -= 2; }if content.height >= 10 { content.y += 1; content.height -= 2; }- // The focus outline occupies existing gutter cells, never a program cell. Compact- // panes without a complete gutter keep all their space and rely on surface contrast.- let outline = (tile.width >= 12 && canvas.width >= 40 && tile.height >= 8 && canvas.height >= 12- && surface.x > canvas.x && surface.y > canvas.y- && surface.right() < canvas.right() && surface.bottom() < canvas.bottom())- .then(|| Rect::new(surface.x - 1, surface.y - 1, surface.width + 2, surface.height + 2));Frame { surface, content, title, outline }}@@ -46,7 +47,8 @@ mod tests {fn small_panes_keep_usable_cells_and_every_rect_stays_inside() {for w in 1..=100 { for h in 1..=40 { for status in [Status::Off, Status::Top, Status::Bottom] {let tile = Rect::new(3, 2, w, h);- let f = frame(tile, tile, status);+ let canvas = Rect::new(0, 0, w + 8, h + 6);+ let f = frame(tile, canvas, status);assert_eq!(f.surface.intersection(tile), f.surface);assert_eq!(f.content.intersection(f.surface), f.content);assert!(f.content.width > 0 && f.content.height > 0);@@ -64,15 +66,18 @@ mod tests {let canvas = Rect::new(0, 0, 120, 40);let left = frame(Rect::new(0, 0, 59, 40), canvas, Status::Top);let right = frame(Rect::new(60, 0, 60, 40), canvas, Status::Top);- assert_eq!(right.surface.x - left.surface.right(), 1);+ assert_eq!(right.outline.unwrap().x - left.outline.unwrap().right(), 1);+ assert_eq!(left.outline.unwrap().intersection(right.outline.unwrap()).width, 0);assert_eq!(left.outline.unwrap().intersection(right.surface).width, 0);assert_eq!(right.outline.unwrap().intersection(left.surface).width, 0);let top = frame(Rect::new(0, 0, 120, 20), canvas, Status::Top);let bottom = frame(Rect::new(0, 20, 120, 20), canvas, Status::Top);- assert_eq!(bottom.surface.y - top.surface.bottom(), 1);+ assert_eq!(bottom.outline.unwrap().y - top.outline.unwrap().bottom(), 1);+ assert_eq!(top.outline.unwrap().intersection(bottom.outline.unwrap()).height, 0);assert_eq!(top.outline.unwrap().intersection(bottom.surface).height, 0);assert_eq!(bottom.outline.unwrap().intersection(top.surface).height, 0);assert!(top.content.y > top.title.unwrap().y);+ assert!(frame(canvas, canvas, Status::Top).outline.is_none());// Short inner tiles share a title row without the normal outer gutter.assert!(frame(Rect::new(20, 20, 40, 5), canvas, Status::Top).outline.is_none());}diff --git a/tui/src/theme.rs b/tui/src/theme.rsindex 6f2b86306..b3b0234ac 100644--- a/tui/src/theme.rs+++ b/tui/src/theme.rs@@ -427,7 +427,8 @@ pub fn palette() -> (Color, Color, bool) {pub struct PanePalette {pub canvas: Color, pub surface: Color, pub inactive_surface: Color,pub foreground: Color, pub inactive_foreground: Color, pub muted: Color,- pub header: Color, pub active_header: Color, pub active_foreground: Color,+ pub active_foreground: Color,+ pub border: Color, pub active_border: Color,pub status: Color, pub status_foreground: Color,}@@ -449,14 +450,14 @@ fn pane_palette_for(native: Option<(Color, Color)>) -> PanePalette {let green = if light { Color::Rgb(58, 102, 48) } else { Color::Rgb(133, 181, 105) };let inactive_surface = if light { mix(bg, foreground, 8) } else { Color::Rgb(64, 64, 64) };PanePalette {- // Inactive panes, gutters and outer space form one continuous backdrop.- canvas: inactive_surface,+ // Separate pane cards sit on a quiet backdrop, with clear space between outlines.+ canvas: if light { mix(bg, foreground, 14) } else { Color::Rgb(32, 32, 32) },surface: bg,inactive_surface,foreground, inactive_foreground: mix(foreground, bg, 9),muted: mix(foreground, bg, 30),- header: if light { mix(bg, foreground, 12) } else { Color::Rgb(64, 64, 64) },- active_header: bg,+ border: mix(inactive_surface, foreground, 20),+ active_border: if light { Color::Rgb(70, 86, 103) } else { Color::Rgb(226, 230, 235) },active_foreground: if light { Color::Rgb(74, 89, 105) } else { Color::Rgb(192, 200, 210) },// A familiar green anchor, subdued enough that the working pane keeps the attention.status: mix(bg, green, if light { 18 } else { 28 }),@@ -1275,9 +1276,9 @@ mod palette_tests {(Color::Rgb(247, 247, 247), Color::Rgb(26, 26, 26))] {let p = super::pane_palette_for(Some((bg, fg)));assert_ne!(p.surface, p.inactive_surface);- assert_eq!(p.inactive_surface, p.canvas);+ assert_ne!(p.inactive_surface, p.canvas);+ assert_ne!(p.border, p.active_border);assert_eq!(p.surface, bg);- assert_ne!(p.header, p.active_header);assert_eq!(p.foreground, fg);let luminance = |c: Color| { let Color::Rgb(r, g, b) = c else { panic!("RGB palette") };299 * r as i32 + 587 * g as i32 + 114 * b as i32 };diff --git a/tui/src/ui.rs b/tui/src/ui.rsindex 542d0d5ef..0ad5c82c0 100644--- a/tui/src/ui.rs+++ b/tui/src/ui.rs@@ -16,6 +16,7 @@ use unicode_width::UnicodeWidthStr;use crate::app::App;use crate::fleet::ago;+use crate::format::clip_middle;use crate::keys;use crate::modal::{Modal, PickerKind, PromptKind};use crate::pane::{Pane, Phase};@@ -281,24 +282,28 @@ fn window(buf: &mut Buffer, app: &mut App, body: Rect) -> Option<Position> {if app.modal.is_some() && !matches!(app.modal, Some(Modal::Copy { .. })) { None } else { cursor }}-/// Integrated titles and a thin focus outline in the gutters. Program cells retain their-/// ANSI colours; moving focus changes no content dimensions or mouse coordinates.+/// Integrated titles and thin outlines: bright for focus, muted otherwise.+/// Program cells retain their ANSI colours; moving focus changes no content dimensions or mouse coordinates.fn pane_chrome(buf: &mut Buffer, app: &App) {let canvas = app.window_area(app.tab());for (id, rect) in &app.rects {let f = crate::pane_frame::frame(*rect, canvas, app.pane_status(app.tab()));let active = Some(*id) == app.focused();- let style = app.style_of(if active { "pane-active-border-style" } else { "pane-border-style" }, app.active, Some(*id));- if let Some(outline) = f.outline.filter(|_| active && app.rects.len() > 1) {+ let style_name = if active { "pane-active-border-style" } else { "pane-border-style" };+ let style = app.style_of(style_name, app.active, Some(*id));+ let own = |name| app.options.has_window_override(name, &app.tab().id, *id);+ let a = app.style_of("window-active-style", app.active, Some(*id));+ let w = app.style_of("window-style", app.active, Some(*id));+ let pane_bg = if active { a.bg.or(w.bg) } else { w.bg };+ let bg = if own(style_name) { style.bg.or(pane_bg) } else { pane_bg };+ let style = style.bg(bg.unwrap_or(Color::Reset));+ if let Some(outline) = f.outline.filter(|_| app.rects.len() > 1) {let lines = app.options.get("pane-border-lines", &app.tab().id, Some(*id)).unwrap_or_default();let (tl, tr, bl, br, hz, vt, _, _) = box_set(&lines);- // The thin outline is drawn over the pane's own background, so the canvas- // cannot leave a gray band between the content and the border glyphs.- let a = app.style_of("window-active-style", app.active, Some(*id));- let w = app.style_of("window-style", app.active, Some(*id));- let border = style.bg(a.bg.or(w.bg).unwrap_or(Color::Reset));+ // Border glyphs share the pane's fill: a canvas-colored border cell would+ // leave a visible half-cell gap between the outline and its interior.let put = |buf: &mut Buffer, x, y, glyph| {- if let Some(cell) = buf.cell_mut((x, y)) { cell.set_symbol(glyph).set_style(border); }+ if let Some(cell) = buf.cell_mut((x, y)) { cell.set_symbol(glyph).set_style(style); }};let (right, bottom) = (outline.right() - 1, outline.bottom() - 1);for x in outline.x + 1..right { put(buf, x, outline.y, hz); put(buf, x, bottom, hz); }@@ -307,6 +312,10 @@ fn pane_chrome(buf: &mut Buffer, app: &App) {put(buf, outline.x, bottom, bl); put(buf, right, bottom, br);}let Some(title) = f.title else { continue };+ let style = if own(style_name) { style } else {+ let palette = theme::pane_palette();+ style.fg(if active { palette.active_foreground } else { palette.muted })+ };buf.set_style(title, style);let marker = if app.marked == Some(*id) { "◆" } else { " " };if title.width > 0 { if let Some(cell) = buf.cell_mut((title.x, title.y)) { cell.set_symbol(marker).set_style(style); } }@@ -2360,27 +2369,6 @@ fn clock(buf: &mut Buffer, app: &App, rect: Rect) {}}-/// Keep a distinguishing suffix, such as "(3)", visible when a home title is long.-fn clip_middle(text: &str, cols: usize) -> String {- use unicode_segmentation::UnicodeSegmentation;- if text.width() <= cols { return text.to_string() }- if cols == 0 { return String::new() }- let left_room = cols / 2;- let right_room = cols - 1 - left_room;- let mut left = String::new();- for g in text.graphemes(true) {- if left.width() + g.width() > left_room { break }- left.push_str(g);- }- let mut right = Vec::new();- let mut width = 0;- for g in text.graphemes(true).rev() {- if width + g.width() > right_room { break }- right.push(g);- width += g.width();- }- format!("{}…{}", left.trim_end(), right.into_iter().rev().collect::<String>().trim_start())-}fn clip(text: &str, cols: usize) -> String {if text.width() <= cols { return text.to_string() }diff --git a/tui/tests/pane-ui.py b/tui/tests/pane-ui.pyindex dbb7a8d09..0d131ff29 100644--- a/tui/tests/pane-ui.py+++ b/tui/tests/pane-ui.py@@ -81,23 +81,25 @@ def mouse(code, x, y, release=False):tmux('send-keys', '-H', '-t', 'test', *[f'{b:02x}' for b in raw])-def background_at(x, y):+def color_at(x, y, foreground=False):row = tmux('capture-pane', '-p', '-e', '-t', 'test', '-S', str(y), '-E', str(y)).splitlines()[0]col, bg = 0, 'default'+ rgb_code, base_code, reset_code = (38, 30, 39) if foreground else (48, 40, 49)for token in re.findall(r'\x1b\[[0-9;:]*m|.', row):if token.startswith('\x1b['):codes = [int(v or 0) for v in token[2:-1].split(';')]i = 0while i < len(codes):c = codes[i]- if c in (0, 49): bg = 'default'+ if c in (0, reset_code): bg = 'default'elif c in (38, 48) and i + 4 < len(codes) and codes[i + 1] == 2:- if c == 48: bg = '#%02x%02x%02x' % tuple(codes[i + 2:i + 5])+ if c == rgb_code: bg = '#%02x%02x%02x' % tuple(codes[i + 2:i + 5])i += 4elif c in (38, 48) and i + 2 < len(codes) and codes[i + 1] == 5:- if c == 48: bg = f'colour{codes[i + 2]}'+ if c == rgb_code: bg = f'colour{codes[i + 2]}'i += 2- elif 40 <= c <= 47: bg = f'colour{c - 40}'+ elif base_code <= c <= base_code + 7: bg = f'colour{c - base_code}'+ elif base_code + 60 <= c <= base_code + 67: bg = f'colour{c - base_code - 52}'i += 1else:width = 0 if unicodedata.combining(token) else (2 if unicodedata.east_asian_width(token) in ('W', 'F') else 1)@@ -106,6 +108,10 @@ def background_at(x, y):return bg+def background_at(x, y):+ return color_at(x, y)++def background(hex_value):raw = f'\x1b]11;{hex_value}\x07'.encode()tmux('send-keys', '-H', '-t', 'test', *[f'{b:02x}' for b in raw])@@ -113,8 +119,8 @@ def background(hex_value):def pane_edge_background(pane, colour):x, y, w, h = map(int, value('#{pane_left} #{pane_top} #{pane_width} #{pane_height}', pane).split())- points = ((x - 2, y - 3), (x + w + 1, y - 3), (x - 2, y + h + 1),- (x + w + 1, y + h + 1), (x - 1, y - 1), (x + w, y + h))+ points = ((x - 1, y - 2), (x + w, y - 2), (x - 1, y + h),+ (x + w, y + h), (x - 1, y - 1), (x + w, y + h // 2))return all(background_at(col, row) == colour for col, row in points)@@ -123,13 +129,19 @@ def pane_background(pane):return background_at(x, y + height - 2)-def pane_outline(pane):+def pane_outline(pane, kind=None):x, y, w, h = map(int, value('#{pane_left} #{pane_top} #{pane_width} #{pane_height}', pane).split())screen = tmux('capture-pane', '-p', '-t', 'test').splitlines()- corners = ((x - 2, y - 3, '┌'), (x + w + 1, y - 3, '┐'),- (x - 2, y + h + 1, '└'), (x + w + 1, y + h + 1, '┘'))- return all(0 <= row < len(screen) and 0 <= col < len(screen[row]) and screen[row][col] == glyph- for col, row, glyph in corners)+ styles = {'thin': '┌┐└┘', 'heavy': '┏┓┗┛', 'double': '╔╗╚╝'}+ points = ((x - 2, y - 3), (x + w + 1, y - 3), (x - 2, y + h + 1), (x + w + 1, y + h + 1))+ return any(all(0 <= row < len(screen) and 0 <= col < len(screen[row]) and screen[row][col] == glyph+ for (col, row), glyph in zip(points, glyphs))+ for glyphs in ([styles[kind]] if kind else styles.values()))+++def pane_outline_color(pane, foreground=True):+ x, y = map(int, value('#{pane_left} #{pane_top}', pane).split())+ return color_at(x - 2, y - 3, foreground=foreground)def snapshot(name):@@ -176,11 +188,16 @@ try:inactive_bg = hn('show', '-gwv', 'window-style').split('bg=')[1]assert active_bg != inactive_bgassert active_bg == '#000000' and inactive_bg == '#404040'- wait(lambda: pane_outline(first) and not pane_outline(second), 'thin outline only around the focused pane')+ wait(lambda: pane_outline(first, 'thin') and pane_outline(second, 'thin') and pane_outline(third, 'thin'), 'separate thin outlines')wait(lambda: pane_background(first) == active_bg and pane_background(second) == inactive_bg, 'whole-pane focus contrast')- assert background_at(149, 0) == inactive_bg, 'gray backdrop includes outer padding'- wait(lambda: pane_edge_background(first, active_bg), 'focused background fills padding and border cells')- assert background_at(99, 20) == inactive_bg, 'gray backdrop includes the unfocused split gutter'+ assert background_at(149, 0) == '#202020', 'dark backdrop surrounds the pane cards'+ wait(lambda: pane_edge_background(first, active_bg), 'focused background fills the area inside its outline')+ assert background_at(49, 20) == background_at(99, 20) == '#202020', 'dark gaps separate independent outlines'+ assert pane_outline_color(first) == '#e2e6eb'+ assert pane_outline_color(second) == '#646464'+ assert pane_outline_color(first, foreground=False) == active_bg+ assert pane_outline_color(second, foreground=False) == inactive_bg+ assert pane_edge_background(second, inactive_bg)tab = value(hn('show', '-gwv', 'window-status-current-format'))label = value('#{window_index}:#{window_short_name}')assert tab.startswith(label + '* '), (tab, label)@@ -215,14 +232,38 @@ try:assert hn('show', '-gwv', option) == 'bold'assert 'reverse' not in hn('show', '-gv', 'status-format[1]')wait(lambda: 'Claude 100%' in tmux('capture-pane', '-p', '-t', 'test').splitlines()[-1], 'plain quota warning reaches the status row')+ hn('set', '-gw', 'pane-border-lines', 'double')+ wait(lambda: pane_outline(first, 'double') and pane_outline(second, 'double'), 'explicit border line choice overrides thin default')+ hn('set', '-gwu', 'pane-border-lines')+ hn('set', '-w', 'pane-active-border-style', 'fg=#aabbcc,bg=#123456')+ hn('set', '-w', 'pane-border-style', 'fg=#778899,bg=#654321')+ wait(lambda: pane_outline_color(first) == '#aabbcc' and pane_outline_color(second) == '#778899', 'window border colors override the palette')+ assert pane_outline_color(first, foreground=False) == '#123456'+ assert pane_outline_color(second, foreground=False) == '#654321'+ hn('set', '-wu', 'pane-active-border-style')+ hn('set', '-wu', 'pane-border-style')+ wait(lambda: pane_outline(first, 'thin') and pane_outline(second, 'thin') and pane_outline_color(first) == '#e2e6eb', 'automatic border appearance restored')snapshot('panes-columns')print('PASS pane UI: whole-pane focus contrast, name before status, compact quota and location', flush=True)+ original_title = value('#{pane_title}', second)+ long_title = 'Investigate the intermittent checkout failure across all supported browser versions (2)'+ hn('select-pane', '-t', second, '-T', long_title)+ x, y, w = map(int, value('#{pane_left} #{pane_top} #{pane_width}', second).split())+ def waiting_heading():+ return tmux('capture-pane', '-p', '-t', 'test').splitlines()[y - 2][x:x + w].strip()+ wait(lambda: waiting_heading().endswith('(2) ?'), 'long pane names retain their suffix and waiting indicator')+ assert '…' in waiting_heading()+ assert value('#{pane_title}', second) == long_title, 'raw pane title must remain unchanged'+ hn('select-pane', '-t', second, '-T', original_title)+ hn('select-pane', '-t', first)+ print('PASS pane UI: long pane titles keep the waiting mark visible', flush=True)+keys('C-b', 'Right')wait(lambda: value('#{pane_id}') == second, 'C-b Right with insets')wait(lambda: pane_background(second) == active_bg and pane_background(first) == inactive_bg, 'keyboard focus moves pane contrast')- wait(lambda: pane_outline(second) and not pane_outline(first), 'keyboard focus moves the outline without stale borders')- wait(lambda: pane_edge_background(second, active_bg), 'focused border background follows keyboard selection')+ wait(lambda: pane_outline(second, 'thin') and pane_outline(first, 'thin') and pane_outline_color(second) == '#e2e6eb' and pane_outline_color(first) == '#646464', 'keyboard focus moves border brightness without stale borders')+ wait(lambda: pane_edge_background(second, active_bg) and pane_outline_color(second, foreground=False) == active_bg and pane_outline_color(first, foreground=False) == inactive_bg, 'focused fill reaches the border after keyboard selection')keys('C-b', 'Right')wait(lambda: value('#{pane_id}') == third, 'second C-b Right')keys('C-b', 'Right')@@ -261,12 +302,12 @@ try:# Titles and padding focus the pane without sending a click to its program.before = len(api()['inputs'])- second_x = int(value('#{pane_left}', second))- mouse(0, second_x, 1)- mouse(0, second_x, 1, release=True)+ second_x, second_y = map(int, value('#{pane_left} #{pane_top}', second).split())+ mouse(0, second_x, second_y - 2)+ mouse(0, second_x, second_y - 2, release=True)wait(lambda: value('#{pane_id}') == second, 'click the pane header')wait(lambda: pane_background(second) == active_bg and pane_background(first) == inactive_bg, 'mouse focus moves pane contrast')- wait(lambda: pane_outline(second) and not pane_outline(first), 'mouse focus moves the outline')+ wait(lambda: pane_outline(second, 'thin') and pane_outline(first, 'thin') and pane_outline_color(second) == '#e2e6eb' and pane_outline_color(first) == '#646464', 'mouse focus moves border brightness')assert len(api()['inputs']) == before, api()['inputs'][before:]mouse(0, border, 10)mouse(32, border + 3, 10)@@ -344,7 +385,7 @@ try:background('#f7f7f7')wait(lambda: hn('show', '-gwv', 'window-active-style') == 'fg=#1a1a1a,bg=#f7f7f7', 'light surface defaults')wait(lambda: pane_background(first) == '#f7f7f7' and pane_background(second) == '#e5e5e5', 'light focus contrast')- wait(lambda: pane_edge_background(first, '#f7f7f7'), 'light surface continues through the focus border')+ wait(lambda: pane_edge_background(first, '#f7f7f7') and pane_outline_color(first, foreground=False) == '#f7f7f7', 'light surface fills the focused pane through its border')light_status = hn('show', '-gv', 'status-style')assert value('#{window_layout}') == layout_before_themesnapshot('panes-light')@@ -354,7 +395,7 @@ try:assert hn('show', '-gwv', 'window-style') == 'fg=red,bg=blue'assert hn('show', '-gwv', 'window-active-style') == 'default'wait(lambda: pane_background(first) == 'colour4' and pane_background(second) == 'colour4', 'custom backgrounds win on active and inactive panes')- wait(lambda: pane_edge_background(first, 'colour4'), 'custom pane background continues through the focus border')+ wait(lambda: pane_edge_background(first, 'colour4') and pane_outline_color(first, foreground=False) == 'colour4', 'custom pane background fills the focused pane through its border')assert len(api()['inputs']) == before, 'terminal query replies reached an application'hn('set', '-gwu', 'window-style')assert hn('show', '-gwv', 'window-active-style').startswith('fg=#f5f5f5,')@@ -379,7 +420,7 @@ try:snapshot('panes-single')hn('kill-window')wait(lambda: value('#{window_id}') == current, 'return from single-pane window')- print('PASS pane UI: full backdrop, right-aligned context and single-pane presentation', flush=True)+ print('PASS pane UI: independent pane cards, right-aligned context and single-pane presentation', flush=True)finally:if started:if OUTPUT: