From f5d6ed0b40f752a2c60e9723f9f39cd4df9dd7e9 Mon Sep 17 00:00:00 2001 From: bluekani <24561326+bluekani@users.noreply.github.com> Date: Tue, 2 Jun 2026 00:26:05 +0900 Subject: [PATCH] feat(serial): add support top placement of free-input options in the selector --- tabby-core/src/api/selector.ts | 1 + .../src/components/selectorModal.component.ts | 13 ++++++++++++- tabby-serial/src/components/serialTab.component.ts | 3 ++- tabby-serial/src/profiles.ts | 3 ++- 4 files changed, 17 insertions(+), 3 deletions(-) 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) {