Skip to content

Commit

Permalink
fix: enquirer#416 press up or down will throw error when list only ha…
Browse files Browse the repository at this point in the history
…s disabled choice
  • Loading branch information
xulingling0 committed Jan 4, 2023
1 parent 36785f3 commit 2c3dd6e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/types/array.js
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ class ArrayPrompt extends Prompt {
return this.scrollUp();
}
this.index = ((idx - 1 % len) + len) % len;
if (this.isDisabled()) {
if (this.isDisabled() && this.index !== idx) {
return this.up();
}
return this.render();
Expand All @@ -395,7 +395,7 @@ class ArrayPrompt extends Prompt {
return this.scrollDown();
}
this.index = (idx + 1) % len;
if (this.isDisabled()) {
if (this.isDisabled() && this.index !== idx) {
return this.down();
}
return this.render();
Expand Down

0 comments on commit 2c3dd6e

Please sign in to comment.