Skip to content

Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows

Put preview-tab availability on the label (#4174)

Maximilian Roos21ed22e45da5
diff --git a/.claude/skills/writing-user-outputs/SKILL.md b/.claude/skills/writing-user-outputs/SKILL.md
index 791db1a1d..862783d88 100644
--- a/.claude/skills/writing-user-outputs/SKILL.md
+++ b/.claude/skills/writing-user-outputs/SKILL.md
@@ -822,7 +822,14 @@ to the render rather than to the cell emitting it: `LayoutConfig::link_style`
answers it once for a whole row, so a CI reference and a dev-server port can't
disagree. Two destinations carry no links, and so no underline: a terminal
without OSC 8 support, where `wt list` prints the dev-server URL in full, and
-the picker, whose rows pass through skim.
+the picker's rows, which `Destination::picker` renders as
+`LinkStyle::Unlinked` (that variant's docstring has the reason). Nothing in the
+picker is clickable, by two routes: a row's link style is decided at render
+time, so it carries no OSC 8 to begin with, and the preview pane is parsed by
+skim through `ansi_to_tui`, which keeps none. Underline there is
+free to mean something else, and the preview pane spends it twice: on a URL,
+marking a reference rather than a link (`pr_pane::url_line`), and on the active
+tab in the tab bar (`items::render_preview_tabs`).
## Design Principles
diff --git a/docs/src/content/docs/switch.md b/docs/src/content/docs/switch.md
index e70cc3e5f..5632cd6a7 100644
--- a/docs/src/content/docs/switch.md
+++ b/docs/src/content/docs/switch.md
@@ -122,7 +122,7 @@ The filter matches each row's branch, path, and — when it has a PR/MR — the
7. **pr** — The selected row's PR/MR, for any row whose branch has one
8. **comments** — The PR/MR's comment thread, fetched from the forge for any row whose branch has one
-The comparison base is the merge-base with the default branch, or with its upstream when the local default branch lags. The picker opens on **diff** for local rows and **pr** for a PR/MR listed by `--prs` but not available locally. `Tab` and `Shift-Tab` skip tabs without content; `Alt-1` through `Alt-8` open any tab directly. After you choose a tab, that choice stays active while you navigate.
+The comparison base is the merge-base with the default branch, or with its upstream when the local default branch lags. The picker opens on **diff** for local rows and **pr** for a PR/MR listed by `--prs` but not available locally. A tab with no content for the selected row has a dimmed label, and the active tab's label is underlined. `Tab` and `Shift-Tab` skip the dimmed tabs; `Alt-1` through `Alt-8` open any tab directly. After you choose a tab, that choice stays active while you navigate.
**Pager configuration:** The preview panel pipes diff output through git's pager. Override in user config:
diff --git a/plugins/worktrunk/skills/worktrunk/reference/switch.md b/plugins/worktrunk/skills/worktrunk/reference/switch.md
index bcbeefc87..f8988bc89 100644
--- a/plugins/worktrunk/skills/worktrunk/reference/switch.md
+++ b/plugins/worktrunk/skills/worktrunk/reference/switch.md
@@ -100,7 +100,7 @@ The filter matches each row's branch, path, and — when it has a PR/MR — the
7. **pr** — The selected row's PR/MR, for any row whose branch has one
8. **comments** — The PR/MR's comment thread, fetched from the forge for any row whose branch has one
-The comparison base is the merge-base with the default branch, or with its upstream when the local default branch lags. The picker opens on **diff** for local rows and **pr** for a PR/MR listed by `--prs` but not available locally. `Tab` and `Shift-Tab` skip tabs without content; `Alt-1` through `Alt-8` open any tab directly. After you choose a tab, that choice stays active while you navigate.
+The comparison base is the merge-base with the default branch, or with its upstream when the local default branch lags. The picker opens on **diff** for local rows and **pr** for a PR/MR listed by `--prs` but not available locally. A tab with no content for the selected row has a dimmed label, and the active tab's label is underlined. `Tab` and `Shift-Tab` skip the dimmed tabs; `Alt-1` through `Alt-8` open any tab directly. After you choose a tab, that choice stays active while you navigate.
**Pager configuration:** The preview panel pipes diff output through git's pager. Override in user config:
diff --git a/skills/worktrunk/reference/switch.md b/skills/worktrunk/reference/switch.md
index bcbeefc87..f8988bc89 100644
--- a/skills/worktrunk/reference/switch.md
+++ b/skills/worktrunk/reference/switch.md
@@ -100,7 +100,7 @@ The filter matches each row's branch, path, and — when it has a PR/MR — the
7. **pr** — The selected row's PR/MR, for any row whose branch has one
8. **comments** — The PR/MR's comment thread, fetched from the forge for any row whose branch has one
-The comparison base is the merge-base with the default branch, or with its upstream when the local default branch lags. The picker opens on **diff** for local rows and **pr** for a PR/MR listed by `--prs` but not available locally. `Tab` and `Shift-Tab` skip tabs without content; `Alt-1` through `Alt-8` open any tab directly. After you choose a tab, that choice stays active while you navigate.
+The comparison base is the merge-base with the default branch, or with its upstream when the local default branch lags. The picker opens on **diff** for local rows and **pr** for a PR/MR listed by `--prs` but not available locally. A tab with no content for the selected row has a dimmed label, and the active tab's label is underlined. `Tab` and `Shift-Tab` skip the dimmed tabs; `Alt-1` through `Alt-8` open any tab directly. After you choose a tab, that choice stays active while you navigate.
**Pager configuration:** The preview panel pipes diff output through git's pager. Override in user config:
diff --git a/src/cli/mod.rs b/src/cli/mod.rs
index b1e26569b..c20928e30 100644
--- a/src/cli/mod.rs
+++ b/src/cli/mod.rs
@@ -723,7 +723,7 @@ The filter matches each row's branch, path, and — when it has a PR/MR — the
7. **pr** — The selected row's PR/MR, for any row whose branch has one
8. **comments** — The PR/MR's comment thread, fetched from the forge for any row whose branch has one
-The comparison base is the merge-base with the default branch, or with its upstream when the local default branch lags. The picker opens on **diff** for local rows and **pr** for a PR/MR listed by `--prs` but not available locally. `Tab` and `Shift-Tab` skip tabs without content; `Alt-1` through `Alt-8` open any tab directly. After you choose a tab, that choice stays active while you navigate.
+The comparison base is the merge-base with the default branch, or with its upstream when the local default branch lags. The picker opens on **diff** for local rows and **pr** for a PR/MR listed by `--prs` but not available locally. A tab with no content for the selected row has a dimmed label, and the active tab's label is underlined. `Tab` and `Shift-Tab` skip the dimmed tabs; `Alt-1` through `Alt-8` open any tab directly. After you choose a tab, that choice stays active while you navigate.
**Pager configuration:** The preview panel pipes diff output through git's pager. Override in user config:
diff --git a/src/commands/list/collect/mod.rs b/src/commands/list/collect/mod.rs
index 7b032782b..9f98137a2 100644
--- a/src/commands/list/collect/mod.rs
+++ b/src/commands/list/collect/mod.rs
@@ -1367,7 +1367,7 @@ pub fn collect(
// Calculate layout from items (worktrees, local branches, and remote branches).
// The picker passes an explicit width because the list only gets part of the
// terminal — the rest belongs to the preview pane — and takes its rows
- // link-free because skim mangles OSC 8 (see `Destination`).
+ // link-free (see `LinkStyle::Unlinked`).
let width = list_width.or_else(terminal_width).unwrap_or(usize::MAX);
let destination = if progressive_handler.is_some() {
super::layout::Destination::picker(width)
diff --git a/src/commands/list/layout.rs b/src/commands/list/layout.rs
index 8e260c635..17d441cd9 100644
--- a/src/commands/list/layout.rs
+++ b/src/commands/list/layout.rs
@@ -678,9 +678,11 @@ pub enum LinkStyle {
/// An underlined OSC 8 link. A dev-server URL shows as `:3000` with the URL
/// itself inside the escape.
Linked,
- /// The same short text, with neither escape nor underline: the picker feeds
- /// its rows through skim, whose pipeline mangles OSC 8 into garbage like
- /// `^[8;;…`. Nothing on those rows is clickable, so nothing is underlined.
+ /// The same short text, with neither escape nor underline: a picker row is
+ /// parsed by `ansi_to_tui` (`items::ansi_to_line`), whose OSC arm reads
+ /// to a BEL, while `osc8` terminates a link with ST — so the parser runs
+ /// off the end of the line and takes the link's own text with it. Nothing
+ /// on those rows is clickable, so nothing is underlined.
/// The column is sized for the short form either way, so a dev-server URL
/// still collapses to `:3000`.
Unlinked,
@@ -709,7 +711,8 @@ impl LinkStyle {
/// The two travel together because one fact decides both. `wt list` writes to
/// the terminal, so it gets the full width and its escapes arrive intact. The
/// picker hands its rows to skim, which grants the list only part of the
-/// terminal — the rest is the preview pane — and mangles OSC 8 on the way.
+/// terminal — the rest is the preview pane — and takes them link-free
+/// ([`LinkStyle::Unlinked`] has the reason).
#[derive(Clone, Copy, Debug)]
pub struct Destination {
pub width: usize,
diff --git a/src/commands/list/render.rs b/src/commands/list/render.rs
index 66050f528..55c0454d1 100644
--- a/src/commands/list/render.rs
+++ b/src/commands/list/render.rs
@@ -1444,8 +1444,8 @@ mod tests {
/// A row's link markup is a property of the render, not of the cell that
/// happens to emit it: the CI reference and the dev-server port either both
/// carry an underlined OSC 8 link or neither does. The picker renders
- /// `Unlinked` because skim mangles the escape, and an underline there would
- /// mark text with nothing behind it.
+ /// `Unlinked` (`layout::LinkStyle::Unlinked` has the reason), and an
+ /// underline there would mark text with nothing behind it.
#[test]
fn test_link_markup_is_uniform_across_a_row() {
use super::super::ci_status::{CiSource, CiStatus, PrRef, PrStatus};
diff --git a/src/commands/picker/items.rs b/src/commands/picker/items.rs
index c75b88a34..e5c0a9de9 100644
--- a/src/commands/picker/items.rs
+++ b/src/commands/picker/items.rs
@@ -11,7 +11,7 @@ use std::sync::{Arc, Mutex};
use ansi_to_tui::IntoText;
use anstyle::Reset;
-use color_print::cformat;
+use color_print::{cformat, cstr};
use dashmap::DashMap;
use ratatui::style::{Color, Modifier};
use ratatui::text::{Line, Span};
@@ -742,7 +742,7 @@ pub(super) struct LocalContent {
/// (`TaskContext::comparison_base` — the upstream ref when the local default
/// lags it), so a stale fork default doesn't inflate it. The branch-diff and
/// summary panes diff against the **same** base
- /// (`Repository::branch_diff_spec`), so the dimmed number and the pane agree
+ /// (`Repository::branch_diff_spec`), so the dimmed tab and the pane agree
/// even on a fork whose local default lags upstream.
branch_diff: Option<bool>,
/// `upstream`: the branch is ahead of or behind its tracking ref. Combined
@@ -790,10 +790,10 @@ impl LocalContent {
/// Which preview tabs have renderable content for the selected row.
///
-/// Empty tabs are de-emphasized in the bar (number dimmed). Skim computes a
-/// preview once per selection and cannot re-query it mid-selection (see
-/// `loading_placeholder`). Two genuine axes drive availability, and `--prs`
-/// touches neither — it only decides whether a PR row is *listed* at all:
+/// Empty tabs are dimmed in the bar. Skim computes a preview once per selection
+/// and cannot re-query it mid-selection (see `loading_placeholder`). Two genuine
+/// axes drive availability, and `--prs` touches neither — it only decides
+/// whether a PR row is *listed* at all:
///
/// - The local-checkout tabs: the three subsidiary diff tabs (`working_tree` /
/// `branch_diff` / `upstream`) follow the row's live [`LocalContent`]
@@ -908,6 +908,24 @@ struct Tab {
has_content: bool,
}
+impl Tab {
+ /// Style the text that speaks for this tab — its label, or in the compact
+ /// bar the bare digit that replaces one — with the bar's two signals (see
+ /// [`render_preview_tabs`]): brightness carries availability (normal = has
+ /// content, dim = empty for this row) and underline carries the active tab.
+ /// Bold reinforces an active tab that has content. An active-but-empty tab
+ /// takes the underline alone, because `[2m[1m` leaves the terminal to pick
+ /// one intensity and the dim is the signal worth keeping.
+ fn styled(&self, text: &str) -> String {
+ match (self.has_content, self.is_active) {
+ (true, true) => cformat!("<bold,underline>{}</>", text),
+ (true, false) => text.to_string(),
+ (false, true) => cformat!("<dim,underline>{}</>", text),
+ (false, false) => cformat!("<dim>{}</>", text),
+ }
+ }
+}
+
/// Longest preview body handed to skim, in lines.
///
/// skim scrolls the pane through ratatui's `Paragraph::scroll`, whose offset is
@@ -952,25 +970,37 @@ fn cap_preview_lines(mut body: String) -> (String, Option<String>) {
/// Render the preview tab bar, shared by worktree rows and `--prs` rows.
///
/// Every full-form tab keeps its `N: label` text — only the formatting varies,
-/// so the accelerators stay discoverable. Two **orthogonal** signals carry
-/// through the styling: the **number's** brightness says whether the tab is
-/// selectable (normal = has content, dim = empty for this row — see
-/// `TabAvailability`), and the **label's** weight says whether it's the active
-/// mode (bold = active, dim = inactive). The two compose independently: an empty
-/// tab dims its number whether or not it's selected, but the active tab's label
-/// still bolds — so an active-but-empty tab (dim number, bold label) stays
-/// distinct from an inactive-empty one (dim number, dim label), and the selected
-/// tab is always identifiable even when it has nothing to show (its pane, e.g.
-/// "… has no PR", says the rest).
+/// so the accelerators stay discoverable. The **label** carries two
+/// **orthogonal** signals: **brightness** says whether the tab is selectable
+/// (normal = has content, dim = empty for this row — see `TabAvailability`),
+/// and **underline** marks the active mode. The two compose independently, so
+/// an active-but-empty label (dim, underlined) stays distinct both from an
+/// inactive-empty one (dim) and from an active label that has content (bold,
+/// underlined) — the selected tab is always identifiable even when it has
+/// nothing to show (its pane, e.g. "… has no PR", says the rest).
+///
+/// The accelerator digit and the [`TAB_DIVIDER`]s stay out of it: `alt-N` opens
+/// any tab whatever the row holds, so a digit that dimmed would describe the
+/// label beside it rather than the key, and dividers that didn't dim would be
+/// the brightest thing left on a row whose labels are mostly empty.
+///
+/// Underline is the one attribute this pane spends twice —
+/// [`pr_pane::url_line`] underlines a URL a few rows below the bar — and that's
+/// a decision rather than an oversight: nothing in a preview is clickable, so
+/// neither underline is marking a link, and the alternatives cost more. Reverse
+/// video cancels the dim it would have to compose with, and a leading glyph
+/// shifts every later tab's column as the active one moves.
///
/// **Width adaptation.** skim renders previews with wrapping off (its default),
/// so a tab bar wider than `width` would truncate on the right — and the `pr` /
/// `comments` tabs, exactly the ones with content on a `--prs` row, sit at that
/// end. When the eight full-form tabs don't fit, the bar falls back to a compact
/// form (`1 2: log 3 …`): every accelerator digit stays visible, but only the
-/// active tab keeps its label. The two style signals survive — empty digits dim,
-/// the active digit+label bolds — so navigation works at any width. `width` is
-/// the preview pane width skim reports.
+/// active tab keeps its label. An inactive tab is then a bare digit with no
+/// label to carry the signals, so there the digit takes the label's styling —
+/// empty digits dim, and the active tab's label still bolds and underlines — so
+/// navigation works at any width. `width` is the preview pane width skim
+/// reports.
pub(super) fn render_preview_tabs(
mode: PreviewMode,
avail: TabAvailability,
@@ -1004,7 +1034,7 @@ pub(super) fn render_preview_tabs(
render_tab_row_compact(&tabs, reset)
};
- // Controls use dim cyan to distinguish from the dimmed (white) tabs above.
+ // Controls use dim cyan to distinguish from the white tabs above.
// The tab numbers above are the alt-N accelerators (bare digits type
// into the query); Tab/shift-tab cycle the same tabs.
//
@@ -1027,51 +1057,36 @@ pub(super) fn render_preview_tabs(
format!("{bar}\n{controls}{reset}\n\n")
}
-/// Full tab bar: `N: label` per tab, ` | `-separated. The number dims when the
-/// tab is empty (not selectable), and the label bolds on the active tab — two
-/// orthogonal signals that compose (see [`render_preview_tabs`]).
+/// The separator between full-form tabs, dim so the labels are what the bar
+/// reads as. A constant because the bar's reset invariant is stated against it
+/// (`test_render_preview_tabs_ansi_codes` splits on it).
+///
+/// It closes its dim with the SGR 22 that `</>` emits rather than with a full
+/// reset — unlike the pane's other styled runs (see `pr_pane::branch_line`),
+/// it sits between two tabs that each end at one, so its own span is all it has
+/// to clear.
+const TAB_DIVIDER: &str = cstr!("<dim> | </>");
+
+/// Full tab bar: `N: ` then the label styled by [`Tab::styled`], tabs joined by
+/// [`TAB_DIVIDER`].
fn render_tab_row_full(tabs: &[Tab], reset: Reset) -> String {
tabs.iter()
- .map(|t| {
- let number = if t.has_content {
- format!("{}:", t.number)
- } else {
- cformat!("<dim>{}:</>", t.number)
- };
- let label = if t.is_active {
- cformat!("<bold>{}</>", t.label)
- } else {
- cformat!("<dim>{}</>", t.label)
- };
- format!("{number} {label}{reset}")
- })
+ .map(|t| format!("{}: {}{reset}", t.number, t.styled(t.label)))
.collect::<Vec<_>>()
- .join(" | ")
+ .join(TAB_DIVIDER)
}
/// Compact tab bar for narrow panes: just the digits, space-separated, with the
-/// active tab keeping its label (`1 2: log 3 …`). The number still dims when
-/// empty and the active digit+label bolds, so both style signals survive and
-/// every accelerator stays visible — only the inactive labels drop.
+/// active tab keeping its label (`1 2: log 3 …`). Styling is [`Tab::styled`]'s,
+/// so both signals survive and every accelerator stays visible — only the
+/// inactive labels drop.
fn render_tab_row_compact(tabs: &[Tab], reset: Reset) -> String {
tabs.iter()
.map(|t| {
if t.is_active {
- // Active: `N: label`, with the number bold (and dim too when empty).
- let number = if t.has_content {
- cformat!("<bold>{}:</>", t.number)
- } else {
- cformat!("<dim,bold>{}:</>", t.number)
- };
- format!("{number} {}{reset}", cformat!("<bold>{}</>", t.label))
+ format!("{}: {}{reset}", t.number, t.styled(t.label))
} else {
- // Inactive: just the digit, dim when empty.
- let number = if t.has_content {
- t.number.to_string()
- } else {
- cformat!("<dim>{}</>", t.number)
- };
- format!("{number}{reset}")
+ format!("{}{reset}", t.styled(&t.number.to_string()))
}
})
.collect::<Vec<_>>()
@@ -2045,10 +2060,10 @@ mod tests {
// Each mode active, on a worktree row whose diffs all have content
// (uncommitted changes, commits ahead, diverged from upstream) with
// summaries enabled but no PR (tabs 1-6 available; tabs 7 pr and 8
- // comments dim). The active mode's label is bold, inactive available
- // labels dim, and on the `pr` iteration tab 7 is active-but-empty —
- // exercising the rule that emptiness dims even the active tab. Verifies
- // labels and structure.
+ // comments dim). The active tab is bold + underlined, inactive available
+ // tabs plain, and on the `pr` iteration tab 7 is active-but-empty —
+ // exercising the rule that emptiness dims even the active tab, which
+ // then carries the underline alone. Verifies labels and structure.
let wt = TabAvailability::worktree(CONTENT_FULL, true, true, false);
for (name, mode) in [
("unified_diff", PreviewMode::UnifiedDiff),
@@ -2069,7 +2084,7 @@ mod tests {
// - `empty_all_local_diffs`: every diff *known* empty (clean working tree,
// no commits ahead, up to date with a present upstream) — dims tabs 1,
// 2, 3, 5, plus 6/7/8, leaving only `log`. This is the behavior the diff
- // tabs gained: a dimmed number once the diff is known empty.
+ // tabs gained: a dimmed tab once the diff is known empty.
// - `pr_row`: a listed-PR row dims the complete/working/committed/
// upstream/summary tabs but keeps log/pr/comments.
assert_snapshot!(
@@ -2857,8 +2872,8 @@ mod tests {
// pane — the dispatch arm `SkimItem::preview` reaches once the picker-state
// state selects mode 7. The pane shows the title and the markdown body.
let pr_pane = row.render_preview(PreviewMode::Pr, WIDE, 24);
- // Strip ANSI before checking the tab labels: the active `pr` tab is bold,
- // so `7: pr` is split by an SGR escape in the raw string (the bar's own
+ // Strip ANSI before checking the tab labels: the active `pr` tab is
+ // styled, so `7: pr` carries SGR escapes in the raw string (the bar's own
// test, `test_render_preview_tabs`, snapshots the styled form).
let bar = pr_pane.ansi_strip().to_string();
assert!(bar.contains("7: pr"), "pr tab: {bar:?}");
@@ -3694,9 +3709,9 @@ mod tests {
// Test that ANSI escape sequences properly reset to prevent style bleeding.
// The per-tab `{reset}` is appended in the full bar regardless of a
// tab's internal styling, so the reset/divider counts hold whether a tab
- // is active (bold label), inactive-available (dim label), or empty (dim
- // number + label — here tabs 7 pr and 8 comments). WIDE forces the full
- // (not compact) bar.
+ // is active (bold + underlined label), inactive-available (unstyled, the
+ // one case with no SGR of its own), or empty (dim label — here tabs 7 pr
+ // and 8 comments). WIDE forces the full (not compact) bar.
let output = render_preview_tabs(
PreviewMode::WorkingTree,
TabAvailability::worktree(CONTENT_FULL, true, true, false),
@@ -3707,15 +3722,17 @@ mod tests {
let second_line = output.lines().nth(1).unwrap();
// Each styled tab should end with a full reset (\x1b[0m) before the divider
- // This prevents bold/dim from bleeding into the " | " dividers
+ // This prevents bold/dim from bleeding into the dividers, which carry
+ // their own dim and close it themselves.
let full_reset = "\x1b[0m";
// Count resets - should have one after each of the 8 tabs
assert_eq!(first_line.matches(full_reset).count(), 8);
- // The sequence should be: style + text + [22m + [0m + divider
- // Check that dividers come after full resets
- let parts: Vec<&str> = first_line.split(" | ").collect();
+ // Each segment is the number, then the label with whatever style it
+ // carries, then a full reset — so a divider always follows one, whether
+ // or not the label opened a style of its own.
+ let parts: Vec<&str> = first_line.split(TAB_DIVIDER).collect();
assert_eq!(parts.len(), 8);
assert!(parts.iter().all(|part| part.ends_with(full_reset)));
diff --git a/src/commands/picker/pr_pane.rs b/src/commands/picker/pr_pane.rs
index 7f139acd3..68dee33ea 100644
--- a/src/commands/picker/pr_pane.rs
+++ b/src/commands/picker/pr_pane.rs
@@ -41,10 +41,10 @@ pub(super) fn header(pr_ref: PrRef, title: Option<&str>) -> String {
/// A field label (`BRANCH`, `URL`, `DESCRIPTION`, …) in the app's cyan all-caps
/// title style, rendered through [`format_heading`] so it matches the section
/// headings across the CLI (`wt config show`, `wt step`, …). A trailing full
-/// `{reset}` closes the span: skim's ANSI parser drops color_print's `</>` (the
-/// SGR 39 `format_heading` itself emits), so the cyan would otherwise bleed into
-/// the value or body (see [`super::items::render_preview_tabs`]). Every label in
-/// the pane goes through this one helper, so they all render identically.
+/// `{reset}` closes the span, under the same rule as [`branch_line`]: what
+/// follows a label is a caller's value, so the cyan ends at the label whatever
+/// that value carries. Every label in the pane goes through this one helper, so
+/// they all render identically.
fn field_label(text: &str) -> String {
let reset = Reset;
format!("{}{reset}", format_heading(&text.to_uppercase(), None))
@@ -63,18 +63,23 @@ pub(super) fn metadata_line(label: &str, value: &str) -> String {
/// for branch identifiers (git and error messages throughout the CLI, the
/// branch summary in `src/summary.rs`). Both panes build
/// the line through here so the styling can't drift between them. The trailing
-/// full `{reset}` closes the bold span: skim's ANSI parser drops the SGR 22 that
-/// color_print's `</>` emits, exactly as the `DESCRIPTION` label and the `draft`
-/// state value handle their own closers.
+/// full `{reset}` closes the bold span, the same way the `DESCRIPTION` label and
+/// the `draft` state value close theirs: a run ends at a full reset wherever
+/// what follows it isn't this code's to know — a caller's value, the next line
+/// of the pane. The tab bar's `items::TAB_DIVIDER` is the case where it is
+/// known, and closes only the dim it opened.
pub(super) fn branch_line(branch: &str) -> String {
let reset = Reset;
metadata_line("branch", &cformat!("<bold>{branch}</>{reset}"))
}
/// The `URL` metadata line, with the url underlined — the app convention for
-/// inline links and references (hints, the fork-push notice). Both panes build
-/// the line through here so the styling can't drift. The trailing full `{reset}`
-/// closes the underline span (skim drops the SGR 24 that `</>` emits).
+/// inline links and references (hints, the fork-push notice). Nothing in a
+/// preview is clickable — skim parses the pane with `ansi_to_tui`, which keeps
+/// no OSC 8 — so the underline here marks a reference rather than a link, which
+/// is why `render_preview_tabs` can spend the same attribute on the active tab.
+/// Both panes build the line through here so the styling can't drift. The
+/// trailing full `{reset}` closes the underline span, per the reset rule above.
pub(super) fn url_line(url: &str) -> String {
let reset = Reset;
metadata_line("url", &cformat!("<underline>{url}</>{reset}"))
@@ -217,7 +222,7 @@ mod tests {
let out = branch_line("feature/auth");
// Bold (SGR 1) wraps the value — the app convention for branch
// identifiers — closed by a full reset so it doesn't bleed past the
- // value (skim drops color_print's `</>`).
+ // value.
assert!(out.contains("\x1b[1m"), "bold value: {out:?}");
assert!(
out.contains("\x1b[0m"),
diff --git a/src/commands/picker/snapshots/wt__commands__picker__items__tests__branch_diff.snap b/src/commands/picker/snapshots/wt__commands__picker__items__tests__branch_diff.snap
index 7804b380b..d2a24b2c5 100644
--- a/src/commands/picker/snapshots/wt__commands__picker__items__tests__branch_diff.snap
+++ b/src/commands/picker/snapshots/wt__commands__picker__items__tests__branch_diff.snap
@@ -2,5 +2,5 @@
source: src/commands/picker/items.rs
expression: "render_preview_tabs(mode, wt, WIDE)"
---
-1: diff | 2: working | 3: committed | 4: log | 5: remote⇅ | 6: summary | 7: pr | 8: comments
+1: diff | 2: working | 3: committed | 4: log | 5: remote⇅ | 6: summary | 7: pr | 8: comments
Enter: switch | ctrl-u/d: scroll | Tab/alt-1…8: preview | alt-c: create | alt-x: remove | alt-y: copy | alt-o: open | alt-r: refresh | alt-p: toggle | Esc: cancel
diff --git a/src/commands/picker/snapshots/wt__commands__picker__items__tests__empty_all_local_diffs.snap b/src/commands/picker/snapshots/wt__commands__picker__items__tests__empty_all_local_diffs.snap
index d069d9080..53e9aae64 100644
--- a/src/commands/picker/snapshots/wt__commands__picker__items__tests__empty_all_local_diffs.snap
+++ b/src/commands/picker/snapshots/wt__commands__picker__items__tests__empty_all_local_diffs.snap
@@ -2,5 +2,5 @@
source: src/commands/picker/items.rs
expression: "render_preview_tabs(PreviewMode::WorkingTree,\nTabAvailability::worktree(CONTENT_EMPTY, true, false, false), WIDE,)"
---
-1: diff | 2: working | 3: committed | 4: log | 5: remote⇅ | 6: summary | 7: pr | 8: comments
+1: diff | 2: working | 3: committed | 4: log | 5: remote⇅ | 6: summary | 7: pr | 8: comments
Enter: switch | ctrl-u/d: scroll | Tab/alt-1…8: preview | alt-c: create | alt-x: remove | alt-y: copy | alt-o: open | alt-r: refresh | alt-p: toggle | Esc: cancel
diff --git a/src/commands/picker/snapshots/wt__commands__picker__items__tests__empty_upstream_and_summary.snap b/src/commands/picker/snapshots/wt__commands__picker__items__tests__empty_upstream_and_summary.snap
index 3077e7038..d7ee71f39 100644
--- a/src/commands/picker/snapshots/wt__commands__picker__items__tests__empty_upstream_and_summary.snap
+++ b/src/commands/picker/snapshots/wt__commands__picker__items__tests__empty_upstream_and_summary.snap
@@ -2,5 +2,5 @@
source: src/commands/picker/items.rs
expression: "render_preview_tabs(PreviewMode::WorkingTree,\nTabAvailability::worktree(LocalContent::default(), false, false, false),\nWIDE,)"
---
-1: diff | 2: working | 3: committed | 4: log | 5: remote⇅ | 6: summary | 7: pr | 8: comments
+1: diff | 2: working | 3: committed | 4: log | 5: remote⇅ | 6: summary | 7: pr | 8: comments
Enter: switch | ctrl-u/d: scroll | Tab/alt-1…8: preview | alt-c: create | alt-x: remove | alt-y: copy | alt-o: open | alt-r: refresh | alt-p: toggle | Esc: cancel
diff --git a/src/commands/picker/snapshots/wt__commands__picker__items__tests__log.snap b/src/commands/picker/snapshots/wt__commands__picker__items__tests__log.snap
index 032b1b035..d9ebf2caa 100644
--- a/src/commands/picker/snapshots/wt__commands__picker__items__tests__log.snap
+++ b/src/commands/picker/snapshots/wt__commands__picker__items__tests__log.snap
@@ -2,5 +2,5 @@
source: src/commands/picker/items.rs
expression: "render_preview_tabs(mode, wt, WIDE)"
---
-1: diff | 2: working | 3: committed | 4: log | 5: remote⇅ | 6: summary | 7: pr | 8: comments
+1: diff | 2: working | 3: committed | 4: log | 5: remote⇅ | 6: summary | 7: pr | 8: comments
Enter: switch | ctrl-u/d: scroll | Tab/alt-1…8: preview | alt-c: create | alt-x: remove | alt-y: copy | alt-o: open | alt-r: refresh | alt-p: toggle | Esc: cancel
diff --git a/src/commands/picker/snapshots/wt__commands__picker__items__tests__pr.snap b/src/commands/picker/snapshots/wt__commands__picker__items__tests__pr.snap
index 38c8e52ee..89fa464a6 100644
--- a/src/commands/picker/snapshots/wt__commands__picker__items__tests__pr.snap
+++ b/src/commands/picker/snapshots/wt__commands__picker__items__tests__pr.snap
@@ -2,5 +2,5 @@
source: src/commands/picker/items.rs
expression: "render_preview_tabs(mode, wt, WIDE)"
---
-1: diff | 2: working | 3: committed | 4: log | 5: remote⇅ | 6: summary | 7: pr | 8: comments
+1: diff | 2: working | 3: committed | 4: log | 5: remote⇅ | 6: summary | 7: pr | 8: comments
Enter: switch | ctrl-u/d: scroll | Tab/alt-1…8: preview | alt-c: create | alt-x: remove | alt-y: copy | alt-o: open | alt-r: refresh | alt-p: toggle | Esc: cancel
diff --git a/src/commands/picker/snapshots/wt__commands__picker__items__tests__pr_row.snap b/src/commands/picker/snapshots/wt__commands__picker__items__tests__pr_row.snap
index efc1387b4..527cb086e 100644
--- a/src/commands/picker/snapshots/wt__commands__picker__items__tests__pr_row.snap
+++ b/src/commands/picker/snapshots/wt__commands__picker__items__tests__pr_row.snap
@@ -2,5 +2,5 @@
source: src/commands/picker/items.rs
expression: "render_preview_tabs(PreviewMode::Pr, TabAvailability::listed_pr(), WIDE)"
---
-1: diff | 2: working | 3: committed | 4: log | 5: remote⇅ | 6: summary | 7: pr | 8: comments
+1: diff | 2: working | 3: committed | 4: log | 5: remote⇅ | 6: summary | 7: pr | 8: comments
Enter: switch | ctrl-u/d: scroll | Tab/alt-1…8: preview | alt-c: create | alt-x: remove | alt-y: copy | alt-o: open | alt-r: refresh | alt-p: toggle | Esc: cancel
diff --git a/src/commands/picker/snapshots/wt__commands__picker__items__tests__summary.snap b/src/commands/picker/snapshots/wt__commands__picker__items__tests__summary.snap
index 33c6871bc..f57c50ca0 100644
--- a/src/commands/picker/snapshots/wt__commands__picker__items__tests__summary.snap
+++ b/src/commands/picker/snapshots/wt__commands__picker__items__tests__summary.snap
@@ -2,5 +2,5 @@
source: src/commands/picker/items.rs
expression: "render_preview_tabs(mode, wt, WIDE)"
---
-1: diff | 2: working | 3: committed | 4: log | 5: remote⇅ | 6: summary | 7: pr | 8: comments
+1: diff | 2: working | 3: committed | 4: log | 5: remote⇅ | 6: summary | 7: pr | 8: comments
Enter: switch | ctrl-u/d: scroll | Tab/alt-1…8: preview | alt-c: create | alt-x: remove | alt-y: copy | alt-o: open | alt-r: refresh | alt-p: toggle | Esc: cancel
diff --git a/src/commands/picker/snapshots/wt__commands__picker__items__tests__unified_diff.snap b/src/commands/picker/snapshots/wt__commands__picker__items__tests__unified_diff.snap
index 6b1b94093..4daef12f4 100644
--- a/src/commands/picker/snapshots/wt__commands__picker__items__tests__unified_diff.snap
+++ b/src/commands/picker/snapshots/wt__commands__picker__items__tests__unified_diff.snap
@@ -2,5 +2,5 @@
source: src/commands/picker/items.rs
expression: "render_preview_tabs(mode, wt, WIDE)"
---
-1: diff | 2: working | 3: committed | 4: log | 5: remote⇅ | 6: summary | 7: pr | 8: comments
+1: diff | 2: working | 3: committed | 4: log | 5: remote⇅ | 6: summary | 7: pr | 8: comments
Enter: switch | ctrl-u/d: scroll | Tab/alt-1…8: preview | alt-c: create | alt-x: remove | alt-y: copy | alt-o: open | alt-r: refresh | alt-p: toggle | Esc: cancel
diff --git a/src/commands/picker/snapshots/wt__commands__picker__items__tests__upstream_diff.snap b/src/commands/picker/snapshots/wt__commands__picker__items__tests__upstream_diff.snap
index 566e9a4d7..3e2e3e8f1 100644
--- a/src/commands/picker/snapshots/wt__commands__picker__items__tests__upstream_diff.snap
+++ b/src/commands/picker/snapshots/wt__commands__picker__items__tests__upstream_diff.snap
@@ -2,5 +2,5 @@
source: src/commands/picker/items.rs
expression: "render_preview_tabs(mode, wt, WIDE)"
---
-1: diff | 2: working | 3: committed | 4: log | 5: remote⇅ | 6: summary | 7: pr | 8: comments
+1: diff | 2: working | 3: committed | 4: log | 5: remote⇅ | 6: summary | 7: pr | 8: comments
Enter: switch | ctrl-u/d: scroll | Tab/alt-1…8: preview | alt-c: create | alt-x: remove | alt-y: copy | alt-o: open | alt-r: refresh | alt-p: toggle | Esc: cancel
diff --git a/src/commands/picker/snapshots/wt__commands__picker__items__tests__working_tree.snap b/src/commands/picker/snapshots/wt__commands__picker__items__tests__working_tree.snap
index b4d6a46a3..8474f79e6 100644
--- a/src/commands/picker/snapshots/wt__commands__picker__items__tests__working_tree.snap
+++ b/src/commands/picker/snapshots/wt__commands__picker__items__tests__working_tree.snap
@@ -2,5 +2,5 @@
source: src/commands/picker/items.rs
expression: "render_preview_tabs(mode, wt, WIDE)"
---
-1: diff | 2: working | 3: committed | 4: log | 5: remote⇅ | 6: summary | 7: pr | 8: comments
+1: diff | 2: working | 3: committed | 4: log | 5: remote⇅ | 6: summary | 7: pr | 8: comments
Enter: switch | ctrl-u/d: scroll | Tab/alt-1…8: preview | alt-c: create | alt-x: remove | alt-y: copy | alt-o: open | alt-r: refresh | alt-p: toggle | Esc: cancel
diff --git a/tests/snapshots/integration__integration_tests__help__help_switch_long.snap b/tests/snapshots/integration__integration_tests__help__help_switch_long.snap
index 53ac2c9cd..3ac0bec1c 100644
--- a/tests/snapshots/integration__integration_tests__help__help_switch_long.snap
+++ b/tests/snapshots/integration__integration_tests__help__help_switch_long.snap
@@ -229,7 +229,7 @@ The filter matches each row's branch, path, and — when it has a PR/MR — the
7. pr — The selected row's PR/MR, for any row whose branch has one
8. comments — The PR/MR's comment thread, fetched from the forge for any row whose branch has one
-The comparison base is the merge-base with the default branch, or with its upstream when the local default branch lags. The picker opens on diff for local rows and pr for a PR/MR listed by --prs but not available locally. Tab and Shift-Tab skip tabs without content; Alt-1 through Alt-8 open any tab directly. After you choose a tab, that choice stays active while you navigate.
+The comparison base is the merge-base with the default branch, or with its upstream when the local default branch lags. The picker opens on diff for local rows and pr for a PR/MR listed by --prs but not available locally. A tab with no content for the selected row has a dimmed label, and the active tab's label is underlined. Tab and Shift-Tab skip the dimmed tabs; Alt-1 through Alt-8 open any tab directly. After you choose a tab, that choice stays active while you navigate.
Pager configuration: The preview panel pipes diff output through git's pager. Override in user config: