@@ -29,7 +29,8 @@ enum Selection {
29
29
EnterText ,
30
30
FuzzyOption ,
31
31
CaseOption ,
32
- MessageSearch ,
32
+ SummarySearch ,
33
+ MessageBodySearch ,
33
34
FilenameSearch ,
34
35
AuthorsSearch ,
35
36
}
@@ -173,8 +174,16 @@ impl LogSearchPopupComponent {
173
174
}
174
175
175
176
fn get_text_options ( & self ) -> Vec < Line > {
176
- let x_message =
177
- if self . options . 0 . contains ( SearchFields :: MESSAGE ) {
177
+ let x_summary =
178
+ if self . options . 0 . contains ( SearchFields :: MESSAGE_SUMMARY )
179
+ {
180
+ "X"
181
+ } else {
182
+ " "
183
+ } ;
184
+
185
+ let x_body =
186
+ if self . options . 0 . contains ( SearchFields :: MESSAGE_BODY ) {
178
187
"X"
179
188
} else {
180
189
" "
@@ -225,11 +234,21 @@ impl LogSearchPopupComponent {
225
234
) ,
226
235
) ] ) ,
227
236
Line :: from( vec![ Span :: styled(
228
- format!( "[{x_message}] messages" , ) ,
237
+ format!( "[{x_summary}] summary" , ) ,
238
+ self . theme. text(
239
+ matches!(
240
+ self . selection,
241
+ Selection :: SummarySearch
242
+ ) ,
243
+ false ,
244
+ ) ,
245
+ ) ] ) ,
246
+ Line :: from( vec![ Span :: styled(
247
+ format!( "[{x_body}] message body" , ) ,
229
248
self . theme. text(
230
249
matches!(
231
250
self . selection,
232
- Selection :: MessageSearch
251
+ Selection :: MessageBodySearch
233
252
) ,
234
253
false ,
235
254
) ,
@@ -254,14 +273,6 @@ impl LogSearchPopupComponent {
254
273
false ,
255
274
) ,
256
275
) ] ) ,
257
- // Line::from(vec![Span::styled(
258
- // "[ ] changes (soon)",
259
- // theme,
260
- // )]),
261
- // Line::from(vec![Span::styled(
262
- // "[ ] hashes (soon)",
263
- // theme,
264
- // )]),
265
276
]
266
277
}
267
278
@@ -278,8 +289,17 @@ impl LogSearchPopupComponent {
278
289
Selection :: CaseOption => {
279
290
self . options . 1 . toggle ( SearchOptions :: CASE_SENSITIVE ) ;
280
291
}
281
- Selection :: MessageSearch => {
282
- self . options . 0 . toggle ( SearchFields :: MESSAGE ) ;
292
+ Selection :: SummarySearch => {
293
+ self . options . 0 . toggle ( SearchFields :: MESSAGE_SUMMARY ) ;
294
+
295
+ if self . options . 0 . is_empty ( ) {
296
+ self . options
297
+ . 0
298
+ . set ( SearchFields :: MESSAGE_BODY , true ) ;
299
+ }
300
+ }
301
+ Selection :: MessageBodySearch => {
302
+ self . options . 0 . toggle ( SearchFields :: MESSAGE_BODY ) ;
283
303
284
304
if self . options . 0 . is_empty ( ) {
285
305
self . options . 0 . set ( SearchFields :: FILENAMES , true ) ;
@@ -296,7 +316,9 @@ impl LogSearchPopupComponent {
296
316
self . options . 0 . toggle ( SearchFields :: AUTHORS ) ;
297
317
298
318
if self . options . 0 . is_empty ( ) {
299
- self . options . 0 . set ( SearchFields :: MESSAGE , true ) ;
319
+ self . options
320
+ . 0
321
+ . set ( SearchFields :: MESSAGE_SUMMARY , true ) ;
300
322
}
301
323
}
302
324
}
@@ -309,16 +331,26 @@ impl LogSearchPopupComponent {
309
331
Selection :: EnterText => Selection :: AuthorsSearch ,
310
332
Selection :: FuzzyOption => Selection :: EnterText ,
311
333
Selection :: CaseOption => Selection :: FuzzyOption ,
312
- Selection :: MessageSearch => Selection :: CaseOption ,
313
- Selection :: FilenameSearch => Selection :: MessageSearch ,
334
+ Selection :: SummarySearch => Selection :: CaseOption ,
335
+ Selection :: MessageBodySearch => {
336
+ Selection :: SummarySearch
337
+ }
338
+ Selection :: FilenameSearch => {
339
+ Selection :: MessageBodySearch
340
+ }
314
341
Selection :: AuthorsSearch => Selection :: FilenameSearch ,
315
342
} ;
316
343
} else {
317
344
self . selection = match self . selection {
318
345
Selection :: EnterText => Selection :: FuzzyOption ,
319
346
Selection :: FuzzyOption => Selection :: CaseOption ,
320
- Selection :: CaseOption => Selection :: MessageSearch ,
321
- Selection :: MessageSearch => Selection :: FilenameSearch ,
347
+ Selection :: CaseOption => Selection :: SummarySearch ,
348
+ Selection :: SummarySearch => {
349
+ Selection :: MessageBodySearch
350
+ }
351
+ Selection :: MessageBodySearch => {
352
+ Selection :: FilenameSearch
353
+ }
322
354
Selection :: FilenameSearch => Selection :: AuthorsSearch ,
323
355
Selection :: AuthorsSearch => Selection :: EnterText ,
324
356
} ;
0 commit comments