From dca4b8c528ab36bd0648334ad9d595e96ae081cf Mon Sep 17 00:00:00 2001 From: Remigiusz Micielski Date: Tue, 6 Aug 2024 11:14:44 +0200 Subject: [PATCH] don't do anything in right() if depth is 0, not down --- src/lib.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 2e13ae1..8338feb 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -146,9 +146,7 @@ impl MenuState { /// /// down highlights "sub item 2" pub fn down(&mut self) { - if self.active_depth() == 0 { - // do nothing - } else if self.active_depth() == 1 { + if self.active_depth() == 1 { self.push(); } else { self.next(); @@ -213,7 +211,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() {