From 63d4a459c70fce6fc93fed4a0c3237d5bcbbf408 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9B=B7=E7=94=B5=E8=8A=BD=E8=A1=A3?= Date: Wed, 7 Oct 2026 03:03:44 -0400 Subject: [PATCH] =?UTF-8?q?Git=20=C2=B7=20BranchList:=20draws=20only=20the?= =?UTF-8?q?=20row=20actions=20its=20owner=20handles?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/git/refs.rs | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/src/git/refs.rs b/src/git/refs.rs index f56787c..94c38dc 100644 --- a/src/git/refs.rs +++ b/src/git/refs.rs @@ -356,23 +356,31 @@ impl RenderOnce for BranchList { as Run }) }; - let actions = if branch.current { + // Only actions the owner handles are drawn. + let actions: Vec = if branch.current { Vec::new() } else { - vec![ - action( - (self.id.clone(), format!("switch-{}", branch.name)).into(), + [ + ( + "switch", IconName::ArrowRight, - i18n::text(cx, "palette.branch.switch", &[]), + "palette.branch.switch", bind(&self.on_switch), ), - action( - (self.id.clone(), format!("delete-{}", branch.name)).into(), + ( + "delete", IconName::Trash2, - i18n::text(cx, "palette.branch.delete", &[]), + "palette.branch.delete", bind(&self.on_delete), ), ] + .into_iter() + .filter_map(|(key, icon, words, run)| { + let run = run?; + let id = (self.id.clone(), format!("{key}-{}", branch.name)).into(); + Some(action(id, icon, i18n::text(cx, words, &[]), Some(run))) + }) + .collect() }; let trailing: Vec = distance(branch) .into_iter()