diff --git a/lib/mp-readline/readline.c b/lib/mp-readline/readline.c
index 31b60e2682a522fc526eb5fdfbab34864afbd6c2..28383b9a3e11d76ac5a91dbac2a9ceb8e98a6ceb 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);
diff --git a/windows/windows_mphal.c b/windows/windows_mphal.c
index f2f8cd9527767c7cf20e9ddd356948f78b37c128..db03571baa510f66bbc2cacb885ade9b521ba903 100644
--- a/windows/windows_mphal.c
+++ b/windows/windows_mphal.c
@@ -92,7 +92,7 @@ void mp_hal_move_cursor_back(uint pos) {
     SetConsoleCursorPosition(con_out, info.dwCursorPosition);
 }
 
-void mp_hal_erase_line_from_cursor() {
+void mp_hal_erase_line_from_cursor(uint n_chars_to_erase) {
     assure_conout_handle();
     CONSOLE_SCREEN_BUFFER_INFO info;
     GetConsoleScreenBufferInfo(con_out, &info);
diff --git a/windows/windows_mphal.h b/windows/windows_mphal.h
index b9ed67e71012c78c37737c74609943826100bbc3..8173d93eca9358d80e64569cf16cfc110e7611ff 100644
--- a/windows/windows_mphal.h
+++ b/windows/windows_mphal.h
@@ -29,4 +29,4 @@
 #define MICROPY_HAL_HAS_VT100 (0)
 
 void mp_hal_move_cursor_back(unsigned int pos);
-void mp_hal_erase_line_from_cursor();
+void mp_hal_erase_line_from_cursor(unsigned int n_chars_to_erase);