From 09cee99bdba2ccb53a68b237cf44ed03910c37e5 Mon Sep 17 00:00:00 2001 From: wugeer <1284057728@qq.com> Date: Wed, 16 Oct 2024 17:15:42 +0800 Subject: [PATCH 1/2] feat: support help popup display viewing progress --- CHANGELOG.md | 1 + asyncgit/src/sync/commit_filter.rs | 3 +-- src/popups/help.rs | 9 +++++++++ src/popups/remotelist.rs | 3 +-- src/tabs/status.rs | 6 ++---- 5 files changed, 14 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e89e1af6cb..0de765f2be 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -38,6 +38,7 @@ Checkout [THEMES.md](./THEMES.md) for more info. ### Added * due to github runner changes, the regular mac build is now arm64, so we added support for intel x86 apple build in nightlies and releases (via separat artifact) * support `BUILD_GIT_COMMIT_ID` enabling builds from `git archive` generated source tarballs or other outside a git repo [[@alerque](https://github.com/alerque)] ([#2187](https://github.com/extrawurst/gitui/pull/2187)) +* support help popup display viewing progress[[@wugeer](https://github.com/wugeer)](https://github.com/extrawurst/gitui/pull/2388)) ### Fixes * update yanked dependency to `libc` to fix building with `--locked`. diff --git a/asyncgit/src/sync/commit_filter.rs b/asyncgit/src/sync/commit_filter.rs index e8c7f36771..cf5a03bfef 100644 --- a/asyncgit/src/sync/commit_filter.rs +++ b/asyncgit/src/sync/commit_filter.rs @@ -214,8 +214,7 @@ pub fn filter_commit_by_search( Ok(msg_summary_match || msg_body_match - || file_match - || authors_match) + || file_match || authors_match) }, )) } diff --git a/src/popups/help.rs b/src/popups/help.rs index ebf687ad5e..9e9b702e71 100644 --- a/src/popups/help.rs +++ b/src/popups/help.rs @@ -67,6 +67,15 @@ impl DrawableComponent for HelpPopup { chunks[0], ); + ui::draw_scrollbar( + f, + area, + &self.theme, + self.cmds.len(), + self.selection as usize, + ui::Orientation::Vertical, + ); + f.render_widget( Paragraph::new(Line::from(vec![Span::styled( Cow::from(format!( diff --git a/src/popups/remotelist.rs b/src/popups/remotelist.rs index 409f44714d..63ce34d0d7 100644 --- a/src/popups/remotelist.rs +++ b/src/popups/remotelist.rs @@ -245,8 +245,7 @@ impl RemoteListPopup { .enumerate() .map(|(i, remote)| { let selected = (self.selection as usize - - self.scroll.get_top()) - == i; + - self.scroll.get_top()) == i; let mut remote_name = remote.clone(); if remote_name.len() > name_length diff --git a/src/tabs/status.rs b/src/tabs/status.rs index 034ffe39e6..7d67f3a522 100644 --- a/src/tabs/status.rs +++ b/src/tabs/status.rs @@ -686,8 +686,7 @@ impl Status { strings::commands::select_staging(&self.key_config), !focus_on_diff, (self.visible - && !focus_on_diff - && self.focus == Focus::WorkDir) + && !focus_on_diff && self.focus == Focus::WorkDir) || force_all, ) .order(strings::order::NAV), @@ -697,8 +696,7 @@ impl Status { strings::commands::select_unstaged(&self.key_config), !focus_on_diff, (self.visible - && !focus_on_diff - && self.focus == Focus::Stage) + && !focus_on_diff && self.focus == Focus::Stage) || force_all, ) .order(strings::order::NAV), From aabd4ffb39c62ef51521439d13c8c30f5e085990 Mon Sep 17 00:00:00 2001 From: wugeer <1284057728@qq.com> Date: Wed, 16 Oct 2024 17:40:55 +0800 Subject: [PATCH 2/2] solve clippy errors --- asyncgit/src/sync/commit_filter.rs | 3 ++- src/popups/remotelist.rs | 3 ++- src/tabs/status.rs | 6 ++++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/asyncgit/src/sync/commit_filter.rs b/asyncgit/src/sync/commit_filter.rs index cf5a03bfef..e8c7f36771 100644 --- a/asyncgit/src/sync/commit_filter.rs +++ b/asyncgit/src/sync/commit_filter.rs @@ -214,7 +214,8 @@ pub fn filter_commit_by_search( Ok(msg_summary_match || msg_body_match - || file_match || authors_match) + || file_match + || authors_match) }, )) } diff --git a/src/popups/remotelist.rs b/src/popups/remotelist.rs index 63ce34d0d7..409f44714d 100644 --- a/src/popups/remotelist.rs +++ b/src/popups/remotelist.rs @@ -245,7 +245,8 @@ impl RemoteListPopup { .enumerate() .map(|(i, remote)| { let selected = (self.selection as usize - - self.scroll.get_top()) == i; + - self.scroll.get_top()) + == i; let mut remote_name = remote.clone(); if remote_name.len() > name_length diff --git a/src/tabs/status.rs b/src/tabs/status.rs index 7d67f3a522..034ffe39e6 100644 --- a/src/tabs/status.rs +++ b/src/tabs/status.rs @@ -686,7 +686,8 @@ impl Status { strings::commands::select_staging(&self.key_config), !focus_on_diff, (self.visible - && !focus_on_diff && self.focus == Focus::WorkDir) + && !focus_on_diff + && self.focus == Focus::WorkDir) || force_all, ) .order(strings::order::NAV), @@ -696,7 +697,8 @@ impl Status { strings::commands::select_unstaged(&self.key_config), !focus_on_diff, (self.visible - && !focus_on_diff && self.focus == Focus::Stage) + && !focus_on_diff + && self.focus == Focus::Stage) || force_all, ) .order(strings::order::NAV),