From cbcede499a97fc7be52c421d8b35fe73a097b7ce Mon Sep 17 00:00:00 2001 From: folkert van heusden Date: Sat, 19 Mar 2022 13:21:29 +0100 Subject: [PATCH] backspace in line editor --- ESP32/esp32.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/ESP32/esp32.cpp b/ESP32/esp32.cpp index c909131..d395af0 100644 --- a/ESP32/esp32.cpp +++ b/ESP32/esp32.cpp @@ -14,7 +14,16 @@ std::string read_terminal_line(const std::string & prompt) if (c == 13 || c == 10) break; - if (c >= 32 && c < 127) { + if (c == 8) { + if (!str.empty()) { + str = str.substr(0, str.size() - 1); + + Serial.print(char(8)); + Serial.print(' '); + Serial.print(char(8)); + } + } + else if (c >= 32 && c < 127) { str += c; Serial.print(c);