diff --git a/tabby-core/src/components/selectorModal.component.ts b/tabby-core/src/components/selectorModal.component.ts index 255dd44f9f..a0a25fb953 100644 --- a/tabby-core/src/components/selectorModal.component.ts +++ b/tabby-core/src/components/selectorModal.component.ts @@ -33,10 +33,11 @@ export class SelectorModalComponent { this.close() } else if (this.filteredOptions.length > 0) { if (event.key === 'PageUp' || event.key === 'ArrowUp' && event.metaKey) { - this.selectedIndex -= 10 + this.selectedIndex -= Math.min(10, this.selectedIndex === 0 ? 1 : this.selectedIndex) event.preventDefault() } else if (event.key === 'PageDown' || event.key === 'ArrowDown' && event.metaKey) { - this.selectedIndex += 10 + const newI = this.filteredOptions.length - this.selectedIndex - 1 + this.selectedIndex += Math.min(10, newI === 0 ? 1 : newI) event.preventDefault() } else if (event.key === 'ArrowUp') { this.selectedIndex--