@@ -650,6 +650,53 @@ describe("flat type-to-filter model picker", () => {
650650 }
651651 } ) ;
652652
653+ test ( "composed Option+D (∂) sets the default instead of filtering the model picker" , async ( ) => {
654+ const defaults : string [ ] = [ ] ;
655+ const { harness, host } = await mountPicker ( {
656+ onSetDefault : ( id ) => defaults . push ( id ) ,
657+ } ) ;
658+ try {
659+ host . openModels ?.( ) ;
660+ await harness . renderOnce ( ) ;
661+ const composed = {
662+ name : "∂" ,
663+ sequence : "∂" ,
664+ ctrl : false ,
665+ meta : false ,
666+ option : false ,
667+ } as KeyEvent ;
668+ expect ( handleListFilterKey ( host . shell , composed ) ) . toBe ( false ) ;
669+ expect ( runOverlayAction ( host . shell , composed ) ) . toBe ( true ) ;
670+ expect ( defaults ) . toEqual ( [ "codex/abk-labs:gpt-5.5" ] ) ;
671+ expect ( host . shell . overlayItems ) . not . toEqual ( [ "(no matches)" ] ) ;
672+ } finally {
673+ host . dispose ( ) ;
674+ harness . destroy ( ) ;
675+ }
676+ } ) ;
677+
678+ test ( "composed Option+D (∂) remains filter text when setting a default is unavailable" , async ( ) => {
679+ const { harness, host } = await mountPicker ( ) ;
680+ try {
681+ host . openModels ?.( ) ;
682+ await harness . renderOnce ( ) ;
683+ const composed = {
684+ name : "∂" ,
685+ sequence : "∂" ,
686+ ctrl : false ,
687+ meta : false ,
688+ option : false ,
689+ } as KeyEvent ;
690+ expect ( handleListFilterKey ( host . shell , composed ) ) . toBe ( true ) ;
691+ await harness . renderOnce ( ) ;
692+ expect ( host . shell . overlayItems ) . toEqual ( [ "(no matches)" ] ) ;
693+ expect ( runOverlayAction ( host . shell , composed ) ) . toBe ( false ) ;
694+ } finally {
695+ host . dispose ( ) ;
696+ harness . destroy ( ) ;
697+ }
698+ } ) ;
699+
653700 test ( "Alt+D on the no-matches sentinel does not set a default" , async ( ) => {
654701 const defaults : string [ ] = [ ] ;
655702 const { harness, host } = await mountPicker ( {
@@ -663,8 +710,35 @@ describe("flat type-to-filter model picker", () => {
663710 }
664711 await harness . renderOnce ( ) ;
665712 expect ( host . shell . overlayItems ) . toEqual ( [ "(no matches)" ] ) ;
666- expect ( runOverlayAction ( host . shell , altD ) ) . toBe ( false ) ;
713+ expect ( runOverlayAction ( host . shell , altD ) ) . toBe ( true ) ;
714+ expect ( defaults ) . toEqual ( [ ] ) ;
715+ expect ( host . shell . overlayKind ) . toBe ( "model_picker" ) ;
716+ } finally {
717+ host . dispose ( ) ;
718+ harness . destroy ( ) ;
719+ }
720+ } ) ;
721+
722+ test ( "composed Option+D (∂) on the no-matches sentinel does not reach the prompt" , async ( ) => {
723+ const defaults : string [ ] = [ ] ;
724+ const { harness, host } = await mountPicker ( {
725+ onSetDefault : ( id ) => defaults . push ( id ) ,
726+ } ) ;
727+ try {
728+ host . shell . prompt . value = "draft" ;
729+ host . openModels ?.( ) ;
730+ await harness . renderOnce ( ) ;
731+ for ( const ch of "zzzz-no-such-model" ) {
732+ harness . pressKey ( ch ) ;
733+ }
734+ await harness . renderOnce ( ) ;
735+ expect ( host . shell . overlayItems ) . toEqual ( [ "(no matches)" ] ) ;
736+
737+ harness . pressKey ( "∂" ) ;
738+ await harness . renderOnce ( ) ;
739+
667740 expect ( defaults ) . toEqual ( [ ] ) ;
741+ expect ( host . shell . prompt . value ) . toBe ( "draft" ) ;
668742 expect ( host . shell . overlayKind ) . toBe ( "model_picker" ) ;
669743 } finally {
670744 host . dispose ( ) ;
0 commit comments