From 634a20c339397c2bc502e48a37c60b141263a666 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Martin?= Date: Sun, 4 Oct 2026 21:27:40 +0200 Subject: [PATCH] key command: del and tab The serial and Debug Console `key` command could type characters but not erase them, so text typed into a field by mistake couldn't be cleared remotely. `key del` and `key tab` inject Delete and Tab. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01EhqxQ49eCju4CzKYNjZzwT --- src/main.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 752b3ba..cd7b2d2 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -325,7 +325,7 @@ static const char* const kHelp = "log level <0-5> ESP-IDF log level (0 none ... 5 verbose)\n" "crash the last crash: firmware, reason, task, backtrace\n" "coredump erase forget the core dump in flash\n" - "key press a key: up down left right select back home, or one character\n" + "key press a key: up down left right select back home del tab, or one character\n" "wifi status | wifi add \n" "irc start | irc dump | irc say \n" "ls [folder] | rm | install (Update from SD)\n" @@ -394,10 +394,11 @@ static void runCommand(String line) { if (line == "burst") for (int i = 1; i <= 5; i++) bus.publish(Event::withText(EventType::Notification, ("Burst " + String(i)).c_str(), 0)); - if (line.startsWith("key ")) { // key up|down|left|right|select|back|home + if (line.startsWith("key ")) { // key up|down|left|right|select|back|home|del|tab String k = line.substring(4); Key key = k == "up" ? Key::Up : k == "down" ? Key::Down : k == "left" ? Key::Left - : k == "right" ? Key::Right : k == "back" ? Key::Back : k == "home" ? Key::Home : Key::Select; + : k == "right" ? Key::Right : k == "back" ? Key::Back : k == "home" ? Key::Home + : k == "del" ? Key::Delete : k == "tab" ? Key::Tab : Key::Select; KeyEvent ev = k.length() == 1 && k[0] > ' ' ? KeyEvent::character((unsigned char)k[0]) : KeyEvent::of(key); if (!power->onKey(millis())) apps->handleKey(ev); }