@@ -19,10 +19,10 @@ class QuickMenuGroup {
1919 this . items = items ;
2020 }
2121
22- updateRendering ( text : string ) : void {
22+ updateRendering ( terms : Array < string > ) : void {
2323 let shouldRender = false ;
2424 for ( let i = 0 ; i < this . items . length ; i ++ ) {
25- const kept = this . items [ i ] . filter ( text ) ;
25+ const kept = this . items [ i ] . filter ( terms ) ;
2626 this . items [ i ] . render ( kept ) ;
2727 if ( kept ) {
2828 shouldRender = true ;
@@ -45,11 +45,20 @@ class QuickMenuItem {
4545 this . #context = context ;
4646 }
4747
48- filter ( text : string ) : boolean {
49- if ( text === "" ) {
48+ filter ( terms : Array < string > ) : boolean {
49+ if ( terms . length === 0 ) {
5050 return true ;
5151 }
52- return this . #searchText. indexOf ( text ) != - 1 ;
52+ for ( let i = 0 ; i < terms . length ; i ++ ) {
53+ if ( terms [ i ] === "" ) {
54+ continue ;
55+ }
56+
57+ if ( this . #searchText. indexOf ( terms [ i ] ) === - 1 ) {
58+ return false ;
59+ }
60+ }
61+ return true ;
5362 }
5463
5564 render ( render : boolean ) : void {
@@ -78,7 +87,7 @@ function RecurseBuildContainers(
7887 groups : Array < QuickMenuGroup >
7988) : void {
8089
81- let currentPath = config ?. name ?? "Menu " ;
90+ let currentPath = config ?. name ?? "" ;
8291 if ( path !== "" ) {
8392 currentPath = path + " / " + currentPath ;
8493 }
@@ -119,7 +128,7 @@ function RecurseBuildContainers(
119128 ) ;
120129
121130 quickItems . push ( new QuickMenuItem (
122- configItem . name ?? "" ,
131+ currentPath + ( configItem . name ?? "" ) ,
123132 itemText ,
124133 configItem
125134 ) ) ;
@@ -239,11 +248,22 @@ export class QuickMenu {
239248 . trim ( )
240249 . toLowerCase ( ) ;
241250
251+ let terms = new Array < string > ( ) ;
252+ if ( searchText !== "" ) {
253+ var potentialTerms = searchText . split ( " " ) ;
254+ for ( let i = 0 ; i < potentialTerms . length ; i ++ ) {
255+ const cleaned = potentialTerms [ i ] . trim ( ) ;
256+ if ( cleaned !== "" ) {
257+ terms . push ( cleaned ) ;
258+ }
259+ }
260+ }
261+
242262 let selection = this . #currentSelection;
243263
244264 for ( let groupIndex = 0 ; groupIndex < this . #menuGroups. length ; groupIndex ++ ) {
245265 const group = this . #menuGroups[ groupIndex ] ;
246- group . updateRendering ( searchText ) ;
266+ group . updateRendering ( terms ) ;
247267
248268 for ( let itemIndex = 0 ; itemIndex < group . items . length ; itemIndex ++ ) {
249269 if ( group . items [ itemIndex ] . rendering ( ) ) {
@@ -262,7 +282,7 @@ export class QuickMenu {
262282 this . #currentSelection = 0 ;
263283 const text = this . #searchText. get ( ) ;
264284 this . #searchText. set ( text . slice ( 0 , text . length - 1 ) ) ;
265- } else if ( / ^ [ a - z A - Z 0 - 9 ] $ / . test ( event . key ) ) {
285+ } else if ( / ^ [ a - z A - Z 0 - 9 ] $ / . test ( event . key ) || event . key === " " ) {
266286 this . #currentSelection = 0 ;
267287 this . #searchText. set ( this . #searchText. get ( ) + event . key ) ;
268288 } else if ( event . key === "ArrowUp" ) {
0 commit comments