From e6ef236f89d994d57e44c6911518ba90a72b0fe8 Mon Sep 17 00:00:00 2001 From: Miguel Palhas Date: Mon, 24 Aug 2026 15:44:06 +0100 Subject: [PATCH] fix(maestro): match the web form's distinct branch-field labels in the TUI (#94) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The draft pane's new-branch gutter was labelled "br:" in both branch modes — since #94's web fix now says "New branch name" / "Pick a branch", mirror the same distinction here: "new:" for the branch-name input, "pick:" for the existing-branch list (which previously had no label at all). --- crates/maestro-tui/src/draft.rs | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/crates/maestro-tui/src/draft.rs b/crates/maestro-tui/src/draft.rs index 9a4c360..d90a685 100644 --- a/crates/maestro-tui/src/draft.rs +++ b/crates/maestro-tui/src/draft.rs @@ -1392,7 +1392,7 @@ impl DraftPane { match self.branch_mode { WorktreeBranchMode::New => { let row = next_row(); - draw_gutter(f, row, "br:"); + draw_gutter(f, row, "new:"); let col = draw_text_field(f, &self.branch, row, field_style(DraftField::BranchNew)); if self.focused_field == DraftField::BranchNew { @@ -1416,6 +1416,7 @@ impl DraftPane { .unwrap_or(0) .min(20); let list_row = next_row(); + draw_gutter(f, list_row, "pick:"); for i in start..(start + capacity).min(len.max(1)) { let y = list_row.y + (i - start) as u16; if y >= list_row.y + list_row.height { @@ -2541,10 +2542,25 @@ mod tests { draft.base_repo = Some(PathBuf::from("/home/u/tea/maestro")); draft.probed_cwd = Some(PathBuf::from("/home/u/tea/maestro")); let rendered = render_to_string(100, 24, |f| draft.render(f, f.area(), true)); - for s in ["[new] [existing]", "br:", "crimson-otter"] { + for s in ["[new] [existing]", "new:", "crimson-otter"] { assert!(rendered.contains(s), "missing {s:?}:\n{rendered}"); } + // The new-branch input and existing-branch picker must not share a + // label — matching the web form's "New branch name" / "Pick a + // branch" (#94). + draft.set_branch_mode(WorktreeBranchMode::Existing); + let rendered = render_to_string(100, 24, |f| draft.render(f, f.area(), true)); + assert!( + rendered.contains("pick:"), + "missing pick: label:\n{rendered}" + ); + assert!( + !rendered.contains("br:"), + "stale ambiguous label:\n{rendered}" + ); + draft.set_branch_mode(WorktreeBranchMode::New); + draft.focused_field = DraftField::WorktreeToggle; draft.on_input(&InputKey::Enter); let rendered = render_to_string(100, 24, |f| draft.render(f, f.area(), true));