@@ -473,17 +473,27 @@ export class Picker<T extends Detail> implements AsyncDisposable {
473
473
}
474
474
this . #sortProcessor. sorterIndex = index ;
475
475
reserve ( ( denops ) => {
476
- this . #sortProcessor. start ( denops , {
477
- items : this . #matchProcessor. items ,
476
+ // NOTE:
477
+ // We need to restart from the matcher processor because
478
+ // sorters and renderers applies changes in-place thus
479
+ // the items would be polluted.
480
+ this . #matchProcessor. start ( denops , {
481
+ items : this . #collectProcessor. items ,
482
+ query : this . #inputComponent. cmdline ,
478
483
} ) ;
479
484
} ) ;
480
485
break ;
481
486
}
482
487
case "switch-sorter-at" :
483
488
this . #sortProcessor. sorterIndex = event . index ;
484
489
reserve ( ( denops ) => {
485
- this . #sortProcessor. start ( denops , {
486
- items : this . #matchProcessor. items ,
490
+ // NOTE:
491
+ // We need to restart from the matcher processor because
492
+ // sorters and renderers applies changes in-place thus
493
+ // the items would be polluted.
494
+ this . #matchProcessor. start ( denops , {
495
+ items : this . #collectProcessor. items ,
496
+ query : this . #inputComponent. cmdline ,
487
497
} ) ;
488
498
} ) ;
489
499
break ;
@@ -498,17 +508,27 @@ export class Picker<T extends Detail> implements AsyncDisposable {
498
508
}
499
509
this . #renderProcessor. rendererIndex = index ;
500
510
reserve ( ( denops ) => {
501
- this . #renderProcessor. start ( denops , {
502
- items : this . #matchProcessor. items ,
511
+ // NOTE:
512
+ // We need to restart from the matcher processor because
513
+ // sorters and renderers applies changes in-place thus
514
+ // the items would be polluted.
515
+ this . #matchProcessor. start ( denops , {
516
+ items : this . #collectProcessor. items ,
517
+ query : this . #inputComponent. cmdline ,
503
518
} ) ;
504
519
} ) ;
505
520
break ;
506
521
}
507
522
case "switch-renderer-at" :
508
523
this . #renderProcessor. rendererIndex = event . index ;
509
524
reserve ( ( denops ) => {
510
- this . #renderProcessor. start ( denops , {
511
- items : this . #matchProcessor. items ,
525
+ // NOTE:
526
+ // We need to restart from the matcher processor because
527
+ // sorters and renderers applies changes in-place thus
528
+ // the items would be polluted.
529
+ this . #matchProcessor. start ( denops , {
530
+ items : this . #collectProcessor. items ,
531
+ query : this . #inputComponent. cmdline ,
512
532
} ) ;
513
533
} ) ;
514
534
break ;
0 commit comments