Skip to content

Commit

Permalink
Fix bar being freezed after moving left or right (#18)
Browse files Browse the repository at this point in the history
* fix bar being freezed after moving left or right

* don't do anything in right() if depth is 0, not down
  • Loading branch information
micielski authored Aug 6, 2024
1 parent 35f63be commit 3b9564a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,9 @@ impl<T: Clone> MenuState<T> {
///
/// left pop "sub sub group"
pub fn left(&mut self) {
if self.active_depth() == 1 {
if self.active_depth() == 0 {
// do nothing
} else if self.active_depth() == 1 {
self.prev();
} else if self.active_depth() == 2 {
self.pop();
Expand Down Expand Up @@ -207,7 +209,9 @@ impl<T: Clone> MenuState<T> {
/// right pushes "sub sub item 2". this differs from case 2 that
/// current highlighted item can be expanded
pub fn right(&mut self) {
if self.active_depth() == 1 {
if self.active_depth() == 0 {
// do nothing
} else if self.active_depth() == 1 {
self.next();
} else if self.active_depth() == 2 {
if self.push().is_none() {
Expand Down

0 comments on commit 3b9564a

Please sign in to comment.