@@ -174,23 +174,29 @@ impl Navigator {
174
174
groups_cache : Default :: default ( ) ,
175
175
} ;
176
176
let sweep = Sweep :: new ( ctx, options) ?;
177
- sweep. scorer_by_name ( Some ( "substr" . to_owned ( ) ) ) . await ?;
177
+ sweep
178
+ . scorer_by_name ( None , Some ( "substr" . to_owned ( ) ) )
179
+ . await ?;
178
180
sweep. bind (
181
+ None ,
179
182
"tab" . parse ( ) ?,
180
183
TAG_COMPLETE . to_owned ( ) ,
181
184
"Complete string or follow directory" . to_owned ( ) ,
182
185
) ;
183
186
sweep. bind (
187
+ None ,
184
188
"ctrl+i" . parse ( ) ?,
185
189
TAG_COMPLETE . to_owned ( ) ,
186
190
"Complete string or follow directory" . to_owned ( ) ,
187
191
) ;
188
192
sweep. bind (
193
+ None ,
189
194
"ctrl+r" . parse ( ) ?,
190
195
TAG_COMMAND_HISTORY_MODE . to_owned ( ) ,
191
196
"Switch to command history view" . to_owned ( ) ,
192
197
) ;
193
198
sweep. bind (
199
+ None ,
194
200
"ctrl+f" . parse ( ) ?,
195
201
TAG_PATH_HISTORY_MODE . to_owned ( ) ,
196
202
"Switch to path history view" . to_owned ( ) ,
@@ -211,11 +217,11 @@ impl Navigator {
211
217
if let Some ( update_task) = self . update_task . take ( ) {
212
218
update_task. abort ( ) ;
213
219
}
214
- self . sweep . items_clear ( ) ;
220
+ self . sweep . items_clear ( None ) ;
215
221
let sweep = self . sweep . clone ( ) ;
216
222
self . update_task = Some (
217
223
tokio:: spawn ( async move {
218
- if let Err ( error) = sweep. items_extend_stream ( items) . await {
224
+ if let Err ( error) = sweep. items_extend_stream ( None , items) . await {
219
225
tracing:: error!( ?error, "[Navigator.list_update]" ) ;
220
226
} ;
221
227
} )
@@ -225,7 +231,7 @@ impl Navigator {
225
231
226
232
async fn path_complete ( & self ) -> Result < Option < Box < dyn NavigatorMode > > , Error > {
227
233
let ( current, query) =
228
- tokio:: try_join!( self . sweep. items_current( ) , self . sweep. query_get( ) ) ?;
234
+ tokio:: try_join!( self . sweep. items_current( None ) , self . sweep. query_get( None ) ) ?;
229
235
230
236
if query. starts_with ( '~' ) || query. starts_with ( '/' ) {
231
237
// navigate path from query string
@@ -258,7 +264,7 @@ impl Navigator {
258
264
) -> Result < Vec < NavigatorItem > , Error > {
259
265
mode. enter ( self ) . await ?;
260
266
if let Some ( query) = query {
261
- self . sweep . query_set ( query) ;
267
+ self . sweep . query_set ( None , query) ;
262
268
}
263
269
while let Some ( event) = self . sweep . next_event ( ) . await {
264
270
match event {
@@ -320,19 +326,22 @@ impl NavigatorMode for CmdHistoryMode {
320
326
async fn enter ( & mut self , navigator : & mut Navigator ) -> Result < ( ) , Error > {
321
327
navigator
322
328
. sweep
323
- . prompt_set ( Some ( "CMD" . to_owned ( ) ) , Some ( CMD_HISTORY_ICON . clone ( ) ) ) ;
324
- navigator. sweep . keep_order ( Some ( true ) ) ;
329
+ . prompt_set ( None , Some ( "CMD" . to_owned ( ) ) , Some ( CMD_HISTORY_ICON . clone ( ) ) ) ;
330
+ navigator. sweep . keep_order ( None , Some ( true ) ) ;
325
331
navigator. sweep . bind (
332
+ None ,
326
333
"alt+g s" . parse ( ) ?,
327
334
TAG_GOTO_SESSION . to_owned ( ) ,
328
335
"Go to session of the current command" . to_owned ( ) ,
329
336
) ;
330
337
navigator. sweep . bind (
338
+ None ,
331
339
"alt+g d" . parse ( ) ?,
332
340
TAG_GOTO_DIRECTORY . to_owned ( ) ,
333
341
"Go to current working directory of the command" . to_owned ( ) ,
334
342
) ;
335
343
navigator. sweep . bind (
344
+ None ,
336
345
"alt+g c" . parse ( ) ?,
337
346
TAG_FILTER_CWD . to_owned ( ) ,
338
347
"Keep only commands that were executed in the current directory" . to_owned ( ) ,
@@ -373,7 +382,7 @@ impl NavigatorMode for CmdHistoryMode {
373
382
async fn exit ( & mut self , navigator : & mut Navigator ) -> Result < ( ) , Error > {
374
383
navigator
375
384
. sweep
376
- . bind ( "alt+g s" . parse ( ) ?, String :: new ( ) , String :: new ( ) ) ;
385
+ . bind ( None , "alt+g s" . parse ( ) ?, String :: new ( ) , String :: new ( ) ) ;
377
386
Ok ( ( ) )
378
387
}
379
388
@@ -385,7 +394,7 @@ impl NavigatorMode for CmdHistoryMode {
385
394
match tag. as_str ( ) {
386
395
TAG_GOTO_SESSION => {
387
396
let session = if self . session . is_none ( ) {
388
- let current = navigator. sweep . items_current ( ) . await ?;
397
+ let current = navigator. sweep . items_current ( None ) . await ?;
389
398
let Some ( NavigatorItem :: History ( entry) ) = current else {
390
399
return Ok ( None ) ;
391
400
} ;
@@ -406,7 +415,7 @@ impl NavigatorMode for CmdHistoryMode {
406
415
Ok ( Some ( CmdHistoryMode :: new ( self . session . clone ( ) , dir) ) )
407
416
}
408
417
TAG_GOTO_DIRECTORY => {
409
- let current = navigator. sweep . items_current ( ) . await ?;
418
+ let current = navigator. sweep . items_current ( None ) . await ?;
410
419
let Some ( NavigatorItem :: History ( entry) ) = current else {
411
420
return Ok ( None ) ;
412
421
} ;
@@ -432,13 +441,16 @@ impl PathMode {
432
441
#[ async_trait]
433
442
impl NavigatorMode for PathMode {
434
443
async fn enter ( & mut self , navigator : & mut Navigator ) -> Result < ( ) , Error > {
435
- navigator
436
- . sweep
437
- . prompt_set ( Some ( path_collapse ( & self . path ) ) , Some ( PATH_NAV_ICON . clone ( ) ) ) ;
438
- navigator. sweep . keep_order ( Some ( true ) ) ;
439
- navigator. sweep . query_set ( self . query . clone ( ) ) ;
444
+ navigator. sweep . prompt_set (
445
+ None ,
446
+ Some ( path_collapse ( & self . path ) ) ,
447
+ Some ( PATH_NAV_ICON . clone ( ) ) ,
448
+ ) ;
449
+ navigator. sweep . keep_order ( None , Some ( true ) ) ;
450
+ navigator. sweep . query_set ( None , self . query . clone ( ) ) ;
440
451
441
452
navigator. sweep . bind (
453
+ None ,
442
454
"backspace" . parse ( ) ?,
443
455
TAG_GOTO_PARENT . to_owned ( ) ,
444
456
"Go to parent directory" . to_owned ( ) ,
@@ -459,7 +471,7 @@ impl NavigatorMode for PathMode {
459
471
async fn exit ( & mut self , navigator : & mut Navigator ) -> Result < ( ) , Error > {
460
472
navigator
461
473
. sweep
462
- . bind ( "backspace" . parse ( ) ?, String :: new ( ) , String :: new ( ) ) ;
474
+ . bind ( None , "backspace" . parse ( ) ?, String :: new ( ) , String :: new ( ) ) ;
463
475
Ok ( ( ) )
464
476
}
465
477
@@ -495,10 +507,12 @@ impl PathHistoryMode {
495
507
#[ async_trait]
496
508
impl NavigatorMode for PathHistoryMode {
497
509
async fn enter ( & mut self , navigator : & mut Navigator ) -> Result < ( ) , Error > {
498
- navigator
499
- . sweep
500
- . prompt_set ( Some ( "PATH" . to_owned ( ) ) , Some ( PATH_HISTORY_ICON . clone ( ) ) ) ;
501
- navigator. sweep . keep_order ( Some ( true ) ) ;
510
+ navigator. sweep . prompt_set (
511
+ None ,
512
+ Some ( "PATH" . to_owned ( ) ) ,
513
+ Some ( PATH_HISTORY_ICON . clone ( ) ) ,
514
+ ) ;
515
+ navigator. sweep . keep_order ( None , Some ( true ) ) ;
502
516
503
517
let mut history = Vec :: new ( ) ;
504
518
// Add current directory as the first item
0 commit comments