@@ -29,6 +29,7 @@ enum Selection {
29
29
CaseOption ,
30
30
MessageSearch ,
31
31
FilenameSearch ,
32
+ AuthorsSearch ,
32
33
}
33
34
34
35
pub struct LogSearchPopupComponent {
@@ -111,6 +112,13 @@ impl LogSearchPopupComponent {
111
112
" "
112
113
} ;
113
114
115
+ let x_authors =
116
+ if self . options . 0 . contains ( SearchFields :: AUTHORS ) {
117
+ "X"
118
+ } else {
119
+ " "
120
+ } ;
121
+
114
122
let x_opt_fuzzy =
115
123
if self . options . 1 . contains ( SearchOptions :: FUZZY_SEARCH ) {
116
124
"X"
@@ -161,15 +169,21 @@ impl LogSearchPopupComponent {
161
169
false ,
162
170
) ,
163
171
) ] ) ,
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
+ ) ] ) ,
164
182
// Line::from(vec![Span::styled(
165
183
// "[ ] changes (soon)",
166
184
// theme,
167
185
// )]),
168
186
// Line::from(vec![Span::styled(
169
- // "[ ] authors (soon)",
170
- // theme,
171
- // )]),
172
- // Line::from(vec![Span::styled(
173
187
// "[ ] hashes (soon)",
174
188
// theme,
175
189
// )]),
@@ -192,14 +206,21 @@ impl LogSearchPopupComponent {
192
206
Selection :: MessageSearch => {
193
207
self . options . 0 . toggle ( SearchFields :: MESSAGE ) ;
194
208
195
- if ! self . options . 0 . contains ( SearchFields :: MESSAGE ) {
209
+ if self . options . 0 . is_empty ( ) {
196
210
self . options . 0 . set ( SearchFields :: FILENAMES , true ) ;
197
211
}
198
212
}
199
213
Selection :: FilenameSearch => {
200
214
self . options . 0 . toggle ( SearchFields :: FILENAMES ) ;
201
215
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 ( ) {
203
224
self . options . 0 . set ( SearchFields :: MESSAGE , true ) ;
204
225
}
205
226
}
@@ -210,19 +231,21 @@ impl LogSearchPopupComponent {
210
231
if arg {
211
232
//up
212
233
self . selection = match self . selection {
213
- Selection :: EnterText => Selection :: FilenameSearch ,
234
+ Selection :: EnterText => Selection :: AuthorsSearch ,
214
235
Selection :: FuzzyOption => Selection :: EnterText ,
215
236
Selection :: CaseOption => Selection :: FuzzyOption ,
216
237
Selection :: MessageSearch => Selection :: CaseOption ,
217
238
Selection :: FilenameSearch => Selection :: MessageSearch ,
239
+ Selection :: AuthorsSearch => Selection :: FilenameSearch ,
218
240
} ;
219
241
} else {
220
242
self . selection = match self . selection {
221
243
Selection :: EnterText => Selection :: FuzzyOption ,
222
244
Selection :: FuzzyOption => Selection :: CaseOption ,
223
245
Selection :: CaseOption => Selection :: MessageSearch ,
224
246
Selection :: MessageSearch => Selection :: FilenameSearch ,
225
- Selection :: FilenameSearch => Selection :: EnterText ,
247
+ Selection :: FilenameSearch => Selection :: AuthorsSearch ,
248
+ Selection :: AuthorsSearch => Selection :: EnterText ,
226
249
} ;
227
250
}
228
251
}
0 commit comments