diff --git a/CHANGELOG.md b/CHANGELOG.md index 75713919..ad74503a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - add `trace-libgit` feature to make git tracing optional [[@dm9pZCAq](https://github.com/dm9pZCAq)] ([#902](https://github.com/extrawurst/gitui/issues/902)) - support merging and rebasing remote branches ([#920](https://github.com/extrawurst/gitui/issues/920)) - add highlighting matches in fuzzy finder ([#893](https://github.com/extrawurst/gitui/issues/893)) +- support `home` and `end` keys in branchlist ([#957](https://github.com/extrawurst/gitui/issues/957)) ## [0.18] - 2021-10-11 diff --git a/src/components/branchlist.rs b/src/components/branchlist.rs index d804621d..20e1386f 100644 --- a/src/components/branchlist.rs +++ b/src/components/branchlist.rs @@ -226,6 +226,14 @@ impl Component for BranchListComponent { return self .move_selection(ScrollType::PageUp) .map(Into::into); + } else if e == self.key_config.home { + return self + .move_selection(ScrollType::Home) + .map(Into::into); + } else if e == self.key_config.end { + return self + .move_selection(ScrollType::End) + .map(Into::into); } else if e == self.key_config.tab_toggle { self.local = !self.local; self.update_branches()?; @@ -447,7 +455,12 @@ impl BranchListComponent { ScrollType::PageUp => self .selection .saturating_sub(self.current_height.get()), - _ => self.selection, + ScrollType::Home => 0, + ScrollType::End => { + let num_branches: u16 = + self.branches.len().try_into()?; + num_branches.saturating_sub(1) + } }; self.set_selection(new_selection)?;