Skip to content

Commit

Permalink
feat(core/selector): PageUp/Down toogle at end of filteredOptions
Browse files Browse the repository at this point in the history
  • Loading branch information
Clem-Fern committed Aug 17, 2023
1 parent d354520 commit ad3b03c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tabby-core/src/components/selectorModal.component.ts
Expand Up @@ -33,10 +33,11 @@ export class SelectorModalComponent<T> {
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--
Expand Down

0 comments on commit ad3b03c

Please sign in to comment.