From ec2982b1c450c448eb2dadda6924bae77f58387c Mon Sep 17 00:00:00 2001 From: Alexander Wiedemann Date: Fri, 6 Aug 2021 09:55:15 +0200 Subject: [PATCH] Filter per search term instead of the entire search input --- tabby-core/src/components/selectorModal.component.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tabby-core/src/components/selectorModal.component.ts b/tabby-core/src/components/selectorModal.component.ts index 000fea0e..8dd256ed 100644 --- a/tabby-core/src/components/selectorModal.component.ts +++ b/tabby-core/src/components/selectorModal.component.ts @@ -50,8 +50,9 @@ export class SelectorModalComponent { if (!f) { this.filteredOptions = this.options.filter(x => !x.freeInputPattern) } else { + const terms = f.split(' ') // eslint-disable-next-line @typescript-eslint/restrict-plus-operands - this.filteredOptions = this.options.filter(x => x.freeInputPattern ?? (x.name + (x.description ?? '')).toLowerCase().includes(f)) + this.filteredOptions = this.options.filter(x => x.freeInputPattern ?? terms.every(term => (x.name + (x.description ?? '')).toLowerCase().includes(term))) } this.selectedIndex = Math.max(0, this.selectedIndex) this.selectedIndex = Math.min(this.filteredOptions.length - 1, this.selectedIndex)