hdt: DEL must be handle as BACKSPACE
authorPierre-Alexandre Meyer <pierre@mouraf.org>
Sat, 11 Apr 2009 17:50:30 +0000 (10:50 -0700)
committerPierre-Alexandre Meyer <pierre@mouraf.org>
Sat, 11 Apr 2009 17:50:30 +0000 (10:50 -0700)
Impact: Better conformity to standards

To conform with serial lines, DEL must be handled as BACKSPACE
Using Ctrl+D to delete a char
Taken from http://www.gnu.org/software/bash/manual/html_node/Commands-For-Text.html
(cherry picked from commit 5be7f0228dea745aa8e1fe18036517675bbe8c1e)

com32/hdt/hdt-cli.c

index ee1dce5..3fd7ce4 100644 (file)
@@ -899,12 +899,12 @@ void start_cli_mode(struct s_hardware *hardware)
                        reset_prompt();
                        break;
 
-                case KEY_DELETE:
-                case KEY_DEL:
-                        /* No need to delete when input is empty */
-                        if (strlen(hdt_cli.input)==0) break;
-                        /* Don't delete when cursor is at the end of the line */
-                        if (hdt_cli.cursor_pos>=strlen(hdt_cli.input)) break;
+               case KEY_CTRL('d'):
+               case KEY_DELETE:
+                       /* No need to delete when input is empty */
+                       if (strlen(hdt_cli.input)==0) break;
+                       /* Don't delete when cursor is at the end of the line */
+                       if (hdt_cli.cursor_pos>=strlen(hdt_cli.input)) break;
 
                        for (int c = hdt_cli.cursor_pos;
                             c < (int)strlen(hdt_cli.input) - 1; c++)
@@ -922,6 +922,7 @@ void start_cli_mode(struct s_hardware *hardware)
                                move_cursor_left(strlen(hdt_cli.input + hdt_cli.cursor_pos));
                        break;
 
+               case KEY_DEL:
                case KEY_BACKSPACE:
                        /* Don't delete prompt */
                        if (hdt_cli.cursor_pos == 0)