Skip to content

Commit

Permalink
Only increment or decrement the selected item, when items exist. (oni…
Browse files Browse the repository at this point in the history
  • Loading branch information
CrossR authored Jul 13, 2019
1 parent d37681a commit 8a5ecec
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/editor/Model/Wildmenu.re
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,13 @@ let reduce = (s, action) =>
}
| CommandlineHide
| WildmenuHide => {show: false, selected: 0, items: empty, count: 0}
| WildmenuNext => {...s, selected: (s.selected + 1) mod s.count}
| WildmenuPrevious => {...s, selected: (s.selected - 1) mod s.count}
| WildmenuNext => {
...s,
selected: s.count > 0 ? (s.selected + 1) mod s.count : 0,
}
| WildmenuPrevious => {
...s,
selected: s.count > 0 ? (s.selected - 1) mod s.count : 0,
}
| _ => s
};

0 comments on commit 8a5ecec

Please sign in to comment.