From b535ff9e5872b5523a37cce9c1c62d648ea3ad35 Mon Sep 17 00:00:00 2001 From: Hernawan Fa'iz Abdillah Date: Thu, 20 Jul 2023 14:03:07 +0700 Subject: [PATCH] handle empty menu as inapplicable --- src/engine.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/engine.rs b/src/engine.rs index c87afac8..8a70b7a3 100644 --- a/src/engine.rs +++ b/src/engine.rs @@ -967,6 +967,11 @@ impl Reedline { return Ok(EventStatus::Handled); } + if menu.get_values().len() == 0 { + menu.menu_event(MenuEvent::Deactivate); + return Ok(EventStatus::Inapplicable); + } + return Ok(EventStatus::Handled); } }