From 928e421284d35c767bbded21e0470b34108c27ef Mon Sep 17 00:00:00 2001 From: kpbaks Date: Sun, 31 Aug 2025 16:37:36 +0200 Subject: [PATCH] Open branches popup from all tabs --- CHANGELOG.md | 1 + src/components/revision_files.rs | 13 +++++++++++++ src/tabs/stashing.rs | 13 +++++++++++++ src/tabs/stashlist.rs | 13 +++++++++++++ 4 files changed, 40 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e60180cdc5..e5505a835d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * new command-line option to override the default log file path (`--logfile`) [[@acuteenvy](https://github.com/acuteenvy)] ([#2539](https://github.com/gitui-org/gitui/pull/2539)) * dx: `make check` checks Cargo.toml dependency ordering using `cargo sort` [[@naseschwarz](https://github.com/naseschwarz)] * add `use_selection_fg` to theme file to allow customizing selection foreground color [[@Upsylonbare](https://github.com/Upsylonbare)] ([#2515](https://github.com/gitui-org/gitui/pull/2515)) +* Support opening branches popup from all tabs [[@kpbaks](https://github.com/kpbaks)] ([#2709](https://github.com/gitui-org/gitui/pull/2709)) ### Changed * improve error messages [[@acuteenvy](https://github.com/acuteenvy)] ([#2617](https://github.com/gitui-org/gitui/pull/2617)) diff --git a/src/components/revision_files.rs b/src/components/revision_files.rs index f3fec043d0..bfb44230dd 100644 --- a/src/components/revision_files.rs +++ b/src/components/revision_files.rs @@ -446,6 +446,13 @@ impl Component for RevisionFilesComponent { ) .order(order::RARE_ACTION), ); + out.push(CommandInfo::new( + strings::commands::open_branch_select_popup( + &self.key_config, + ), + true, + self.is_visible() || force_all, + )); tree_nav_cmds(&self.tree, &self.key_config, out); } else { self.current_file.commands(out, force_all); @@ -523,6 +530,12 @@ impl Component for RevisionFilesComponent { ); } return Ok(EventState::Consumed); + } else if key_match( + key, + self.key_config.keys.select_branch, + ) { + self.queue.push(InternalEvent::SelectBranch); + return Ok(EventState::Consumed); } else if !is_tree_focused { return self.current_file.event(event); } diff --git a/src/tabs/stashing.rs b/src/tabs/stashing.rs index 5b2fe4b496..a06cdef75e 100644 --- a/src/tabs/stashing.rs +++ b/src/tabs/stashing.rs @@ -199,6 +199,13 @@ impl Component for Stashing { self.visible, self.visible || force_all, )); + out.push(CommandInfo::new( + strings::commands::open_branch_select_popup( + &self.key_config, + ), + true, + true, + )); } visibility_blocking(self) @@ -242,6 +249,12 @@ impl Component for Stashing { !self.options.stash_untracked; self.update()?; Ok(EventState::Consumed) + } else if key_match( + k, + self.key_config.keys.select_branch, + ) { + self.queue.push(InternalEvent::SelectBranch); + return Ok(EventState::Consumed); } else { Ok(EventState::NotConsumed) }; diff --git a/src/tabs/stashlist.rs b/src/tabs/stashlist.rs index 1a97a0ac38..cd517170fe 100644 --- a/src/tabs/stashlist.rs +++ b/src/tabs/stashlist.rs @@ -182,6 +182,13 @@ impl Component for StashList { selection_valid, true, )); + out.push(CommandInfo::new( + strings::commands::open_branch_select_popup( + &self.key_config, + ), + true, + true, + )); } visibility_blocking(self) @@ -214,6 +221,12 @@ impl Component for StashList { self.key_config.keys.stash_open, ) { self.inspect(); + } else if key_match( + k, + self.key_config.keys.select_branch, + ) { + self.queue.push(InternalEvent::SelectBranch); + return Ok(EventState::Consumed); } } }