summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorextrawurst <776816+extrawurst@users.noreply.github.com>2023-08-21 12:11:53 +0200
committerGitHub <noreply@github.com>2023-08-21 12:11:53 +0200
commitcde1c7f8831021da9222e89120133e2753414162 (patch)
tree5eda6bbd00956daeaa5be97bf69c1e9f320d18c9 /src
parentd253022f13fb392996e2cef98def7a2291fb5fcc (diff)
Search commits by author (#1822)
Diffstat (limited to 'src')
-rw-r--r--src/components/log_search_popup.rs39
1 files changed, 31 insertions, 8 deletions
diff --git a/src/components/log_search_popup.rs b/src/components/log_search_popup.rs
index ef13b554..c6beb648 100644
--- a/src/components/log_search_popup.rs
+++ b/src/components/log_search_popup.rs
@@ -29,6 +29,7 @@ enum Selection {
CaseOption,
MessageSearch,
FilenameSearch,
+ AuthorsSearch,
}
pub struct LogSearchPopupComponent {
@@ -111,6 +112,13 @@ impl LogSearchPopupComponent {
" "
};
+ let x_authors =
+ if self.options.0.contains(SearchFields::AUTHORS) {
+ "X"
+ } else {
+ " "
+ };
+
let x_opt_fuzzy =
if self.options.1.contains(SearchOptions::FUZZY_SEARCH) {
"X"
@@ -161,15 +169,21 @@ impl LogSearchPopupComponent {
false,
),
)]),
+ Line::from(vec![Span::styled(
+ format!("[{x_authors}] authors",),
+ self.theme.text(
+ matches!(
+ self.selection,
+ Selection::AuthorsSearch
+ ),
+ false,
+ ),
+ )]),
// Line::from(vec![Span::styled(
// "[ ] changes (soon)",
// theme,
// )]),
// Line::from(vec![Span::styled(
- // "[ ] authors (soon)",
- // theme,
- // )]),
- // Line::from(vec![Span::styled(
// "[ ] hashes (soon)",
// theme,
// )]),
@@ -192,14 +206,21 @@ impl LogSearchPopupComponent {
Selection::MessageSearch => {
self.options.0.toggle(SearchFields::MESSAGE);
- if !self.options.0.contains(SearchFields::MESSAGE) {
+ if self.options.0.is_empty() {
self.options.0.set(SearchFields::FILENAMES, true);
}
}
Selection::FilenameSearch => {
self.options.0.toggle(SearchFields::FILENAMES);
- if !self.options.0.contains(SearchFields::FILENAMES) {
+ if self.options.0.is_empty() {
+ self.options.0.set(SearchFields::AUTHORS, true);
+ }
+ }
+ Selection::AuthorsSearch => {
+ self.options.0.toggle(SearchFields::AUTHORS);
+
+ if self.options.0.is_empty() {
self.options.0.set(SearchFields::MESSAGE, true);
}
}
@@ -210,11 +231,12 @@ impl LogSearchPopupComponent {
if arg {
//up
self.selection = match self.selection {
- Selection::EnterText => Selection::FilenameSearch,
+ Selection::EnterText => Selection::AuthorsSearch,
Selection::FuzzyOption => Selection::EnterText,
Selection::CaseOption => Selection::FuzzyOption,
Selection::MessageSearch => Selection::CaseOption,
Selection::FilenameSearch => Selection::MessageSearch,
+ Selection::AuthorsSearch => Selection::FilenameSearch,
};
} else {
self.selection = match self.selection {
@@ -222,7 +244,8 @@ impl LogSearchPopupComponent {
Selection::FuzzyOption => Selection::CaseOption,
Selection::CaseOption => Selection::MessageSearch,
Selection::MessageSearch => Selection::FilenameSearch,
- Selection::FilenameSearch => Selection::EnterText,
+ Selection::FilenameSearch => Selection::AuthorsSearch,
+ Selection::AuthorsSearch => Selection::EnterText,
};
}
}