From 3b9564a639ea10a9b4dff07f438388f794ecd56e Mon Sep 17 00:00:00 2001 From: micielski <73398428+micielski@users.noreply.github.com> Date: Tue, 6 Aug 2024 09:40:28 +0000 Subject: [PATCH] Fix bar being freezed after moving left or right (#18) * fix bar being freezed after moving left or right * don't do anything in right() if depth is 0, not down --- src/lib.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 13adc17..a3f1429 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -174,7 +174,9 @@ impl MenuState { /// /// 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(); @@ -207,7 +209,9 @@ impl MenuState { /// 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() {