diff --git a/tabby-core/src/api/selector.ts b/tabby-core/src/api/selector.ts index 4742fe619..f2fd16c7a 100644 --- a/tabby-core/src/api/selector.ts +++ b/tabby-core/src/api/selector.ts @@ -5,6 +5,7 @@ export interface SelectorOption { result?: T icon?: string freeInputPattern?: string + freeInputPlacement?: 'top'|'bottom' freeInputEquivalent?: string color?: string weight?: number diff --git a/tabby-core/src/components/selectorModal.component.ts b/tabby-core/src/components/selectorModal.component.ts index 19182caf0..7e5da6364 100644 --- a/tabby-core/src/components/selectorModal.component.ts +++ b/tabby-core/src/components/selectorModal.component.ts @@ -89,7 +89,18 @@ export class SelectorModalComponent { { sort: true }, ).search(f) - this.options.filter(x => x.freeInputPattern).sort(firstBy, number>(x => x.weight ?? 0)).forEach(freeOption => { + const freeOptions = this.options + .filter(x => x.freeInputPattern) + .sort(firstBy, number>(x => x.weight ?? 0)) + + // Keep free-input options discoverable during filtering. + const topFreeOptions = freeOptions.filter(x => x.freeInputPlacement === 'top') + const bottomFreeOptions = freeOptions.filter(x => x.freeInputPlacement !== 'top') + + this.filteredOptions = this.filteredOptions.filter(x => !topFreeOptions.includes(x)) + this.filteredOptions = [...topFreeOptions, ...this.filteredOptions] + + bottomFreeOptions.forEach(freeOption => { if (!this.filteredOptions.includes(freeOption)) { this.filteredOptions.push(freeOption) } diff --git a/tabby-serial/src/components/serialTab.component.ts b/tabby-serial/src/components/serialTab.component.ts index 6f03397ce..154d37c32 100644 --- a/tabby-serial/src/components/serialTab.component.ts +++ b/tabby-serial/src/components/serialTab.component.ts @@ -101,7 +101,8 @@ export class SerialTabComponent extends ConnectableTerminalTabComponent { const parsed = Number.parseInt((query ?? '').trim(), 10) if (Number.isInteger(parsed) && parsed > 0) { diff --git a/tabby-serial/src/profiles.ts b/tabby-serial/src/profiles.ts index 59c634e4d..c049fed21 100644 --- a/tabby-serial/src/profiles.ts +++ b/tabby-serial/src/profiles.ts @@ -97,7 +97,8 @@ export class SerialProfilesService extends ConnectableProfileProvider { const parsed = Number.parseInt((query ?? '').trim(), 10) if (Number.isInteger(parsed) && parsed > 0) {