summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2014-04-02 14:28:58 +0100
committerDamien George <damien.p.george@gmail.com>2014-04-02 14:28:58 +0100
commit69dee59ce44685d34662870fff439d7249cace36 (patch)
tree0401c6ab4a7d0fe55c193552b1144c0f88b384c3
parent10e21b977091703dbb22f839465902e91fcc6ac3 (diff)
stmhal: Add backspace key to readline (along with delete key).
-rw-r--r--stmhal/readline.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/stmhal/readline.c b/stmhal/readline.c
index ec13a269a..7df347f03 100644
--- a/stmhal/readline.c
+++ b/stmhal/readline.c
@@ -58,8 +58,8 @@ int readline(vstr_t *line, const char *prompt) {
} else if (c == 27) {
// escape sequence
escape_seq = 1;
- } else if (c == 127) {
- // backspace
+ } else if (c == 8 || c == 127) {
+ // backspace/delete
if (cursor_pos > orig_line_len) {
vstr_cut_out_bytes(line, cursor_pos - 1, 1);
// set redraw parameters
@@ -125,6 +125,7 @@ int readline(vstr_t *line, const char *prompt) {
}
// redraw command prompt, efficiently
+ // TODO we can probably use some more sophisticated VT100 commands here
if (redraw_step_back > 0) {
for (int i = 0; i < redraw_step_back; i++) {
stdout_tx_str("\b");