Skip to content

A Hardware Hacking Tool with Web-Based CLI That Speaks Every Protocol

improve at shell to always select the back index

Geo171bfe4cfb44
diff --git a/src/Shells/UartAtShell.cpp b/src/Shells/UartAtShell.cpp
index d56b3c70..8e9e1a63 100644
--- a/src/Shells/UartAtShell.cpp
+++ b/src/Shells/UartAtShell.cpp
@@ -91,7 +91,7 @@ bool UartAtShell::selectMode(AtMode& outMode) {
items.emplace_back(kExitLabel);
// Sélection
- int index = userInputManager.readValidatedChoiceIndex("Select AT mode", items, 0);
+ int index = userInputManager.readValidatedChoiceIndex("Select AT mode", items, items.size() - 1);
if (index < 0) return false;
const std::size_t uindex = static_cast<std::size_t>(index);
@@ -118,7 +118,7 @@ bool UartAtShell::selectAction(AtActionSlice actions, const AtActionItem*& outAc
// Option "Back"
items.push_back(i > 9 ? "↩️ Back" : " ↩️ Back");
- int index = userInputManager.readValidatedChoiceIndex("Select command", items, 0);
+ int index = userInputManager.readValidatedChoiceIndex("Select command", items, items.size() - 1);
if (index < 0) return false;
if (static_cast<std::size_t>(index) == actions.size) {