Skip to content

Commit

Permalink
Merge pull request letscontrolit#5230 from tonhuisman/feature/Console…
Browse files Browse the repository at this point in the history
…-add-backspace-support

[Console] Support Backspace to correct typos
  • Loading branch information
TD-er authored Jan 21, 2025
2 parents 3b579d4 + 813fc4c commit 6f86e12
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions docs/source/Tools/Tools.rst
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,10 @@ See also: `Serial Helper <../Plugin/SerialHelper.html>`__

.. note:: Make sure to either uncheck "Enable Serial Port Console" or configure another serial port for the console, when either HW Serial0 or its pins are used in a task or on the hardware page for I2C, SPI, SD-card or Ethernet.

Correct typing errors: (added: 2025-01-21)

When typing commands in the console (nothing you type is visible until you press <Enter>), typos can be corrected using the backspace key (ctrl-H). Some terminal configurations may use a different key code for backspace, then this can be re-configured in your terminal software, or you can use ``<ctrl-H>`` for correcting typos.

Special notes on Software Serial
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Expand Down
4 changes: 4 additions & 0 deletions src/src/ESPEasyCore/ESPEasy_Console_Port.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,10 @@ bool EspEasy_Console_Port::process_consoleInput(uint8_t SerialInByte)
}
}

if ((SerialInByte == '\b') && (SerialInByteCounter > 0)) // Correct a typo using BackSpace
{
--SerialInByteCounter;
} else
if ((SerialInByte == '\r') || (SerialInByte == '\n'))
{
// Ignore empty command
Expand Down

0 comments on commit 6f86e12

Please sign in to comment.