diff options
author | Damien George <damien.p.george@gmail.com> | 2015-10-20 13:27:14 +0100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2015-10-20 13:27:14 +0100 |
commit | f961456b29a6ca2bd386a672d2ea2782c925c72f (patch) | |
tree | 1d40359b5e7e527576e8baf1a57387e3cd3a0785 /lib/mp-readline/readline.c | |
parent | 22521ea9e2a83dbcbd6da16d6a76b01aa3bf039a (diff) | |
download | micropython-f961456b29a6ca2bd386a672d2ea2782c925c72f.tar.gz micropython-f961456b29a6ca2bd386a672d2ea2782c925c72f.zip |
lib/mp-readline: Add n_chars argument to mp_hal_erase_line_from_cursor.
If VT100 support is not available then a given implementation of
mp_hal_erase_line_from_cursor might need to know the number of characters
to erase.
This patch does not change generated code when VT100 is supported, since
compiler can optimise away the argument.
Diffstat (limited to 'lib/mp-readline/readline.c')
-rw-r--r-- | lib/mp-readline/readline.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/mp-readline/readline.c b/lib/mp-readline/readline.c index 31b60e2682..28383b9a3e 100644 --- a/lib/mp-readline/readline.c +++ b/lib/mp-readline/readline.c @@ -82,7 +82,8 @@ STATIC void mp_hal_move_cursor_back(uint pos) { } } -STATIC void mp_hal_erase_line_from_cursor(void) { +STATIC void mp_hal_erase_line_from_cursor(uint n_chars_to_erase) { + (void)n_chars_to_erase; mp_hal_stdout_tx_strn("\x1b[K", 3); } #endif @@ -338,8 +339,7 @@ delete_key: if (redraw_from_cursor) { if (rl.line->len < last_line_len) { // erase old chars - // (number of chars to erase: last_line_len - rl.cursor_pos) - mp_hal_erase_line_from_cursor(); + mp_hal_erase_line_from_cursor(last_line_len - rl.cursor_pos); } // draw new chars mp_hal_stdout_tx_strn(rl.line->buf + rl.cursor_pos, rl.line->len - rl.cursor_pos); |