@@ -29,6 +29,7 @@ enum Selection {
2929 CaseOption ,
3030 MessageSearch ,
3131 FilenameSearch ,
32+ AuthorsSearch ,
3233}
3334
3435pub struct LogSearchPopupComponent {
@@ -111,6 +112,13 @@ impl LogSearchPopupComponent {
111112 " "
112113 } ;
113114
115+ let x_authors =
116+ if self . options . 0 . contains ( SearchFields :: AUTHORS ) {
117+ "X"
118+ } else {
119+ " "
120+ } ;
121+
114122 let x_opt_fuzzy =
115123 if self . options . 1 . contains ( SearchOptions :: FUZZY_SEARCH ) {
116124 "X"
@@ -161,15 +169,21 @@ impl LogSearchPopupComponent {
161169 false ,
162170 ) ,
163171 ) ] ) ,
172+ Line :: from( vec![ Span :: styled(
173+ format!( "[{x_authors}] authors" , ) ,
174+ self . theme. text(
175+ matches!(
176+ self . selection,
177+ Selection :: AuthorsSearch
178+ ) ,
179+ false ,
180+ ) ,
181+ ) ] ) ,
164182 // Line::from(vec![Span::styled(
165183 // "[ ] changes (soon)",
166184 // theme,
167185 // )]),
168186 // Line::from(vec![Span::styled(
169- // "[ ] authors (soon)",
170- // theme,
171- // )]),
172- // Line::from(vec![Span::styled(
173187 // "[ ] hashes (soon)",
174188 // theme,
175189 // )]),
@@ -192,14 +206,21 @@ impl LogSearchPopupComponent {
192206 Selection :: MessageSearch => {
193207 self . options . 0 . toggle ( SearchFields :: MESSAGE ) ;
194208
195- if ! self . options . 0 . contains ( SearchFields :: MESSAGE ) {
209+ if self . options . 0 . is_empty ( ) {
196210 self . options . 0 . set ( SearchFields :: FILENAMES , true ) ;
197211 }
198212 }
199213 Selection :: FilenameSearch => {
200214 self . options . 0 . toggle ( SearchFields :: FILENAMES ) ;
201215
202- if !self . options . 0 . contains ( SearchFields :: FILENAMES ) {
216+ if self . options . 0 . is_empty ( ) {
217+ self . options . 0 . set ( SearchFields :: AUTHORS , true ) ;
218+ }
219+ }
220+ Selection :: AuthorsSearch => {
221+ self . options . 0 . toggle ( SearchFields :: AUTHORS ) ;
222+
223+ if self . options . 0 . is_empty ( ) {
203224 self . options . 0 . set ( SearchFields :: MESSAGE , true ) ;
204225 }
205226 }
@@ -210,19 +231,21 @@ impl LogSearchPopupComponent {
210231 if arg {
211232 //up
212233 self . selection = match self . selection {
213- Selection :: EnterText => Selection :: FilenameSearch ,
234+ Selection :: EnterText => Selection :: AuthorsSearch ,
214235 Selection :: FuzzyOption => Selection :: EnterText ,
215236 Selection :: CaseOption => Selection :: FuzzyOption ,
216237 Selection :: MessageSearch => Selection :: CaseOption ,
217238 Selection :: FilenameSearch => Selection :: MessageSearch ,
239+ Selection :: AuthorsSearch => Selection :: FilenameSearch ,
218240 } ;
219241 } else {
220242 self . selection = match self . selection {
221243 Selection :: EnterText => Selection :: FuzzyOption ,
222244 Selection :: FuzzyOption => Selection :: CaseOption ,
223245 Selection :: CaseOption => Selection :: MessageSearch ,
224246 Selection :: MessageSearch => Selection :: FilenameSearch ,
225- Selection :: FilenameSearch => Selection :: EnterText ,
247+ Selection :: FilenameSearch => Selection :: AuthorsSearch ,
248+ Selection :: AuthorsSearch => Selection :: EnterText ,
226249 } ;
227250 }
228251 }
0 commit comments