diff options
author | Erwan Velu <erwan.velu@free.fr> | 2009-05-03 10:30:20 +0200 |
---|---|---|
committer | Erwan Velu <erwan.velu@free.fr> | 2009-05-03 10:30:20 +0200 |
commit | 3e5b7b7a03bc8264c2b68b2a3a174ec548b65f37 (patch) | |
tree | 8edca4e8b35981263054d4ac4bf05953b7cd4e8c | |
parent | 485b4c07c607e2860b4ad96d94627a4394c48721 (diff) | |
download | hdt-3e5b7b7a03bc8264c2b68b2a3a174ec548b65f37.tar.gz hdt-3e5b7b7a03bc8264c2b68b2a3a174ec548b65f37.tar.xz hdt-3e5b7b7a03bc8264c2b68b2a3a174ec548b65f37.zip |
hdt: fixing BACKSPACE behavior
Impact: Fixing CLI behavior
Prior to that commit, the BACKSPACE didn't worked properly.
In some cases, the cursor was misplaced and was confusing user.
-rw-r--r-- | com32/hdt/hdt-cli.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/com32/hdt/hdt-cli.c b/com32/hdt/hdt-cli.c index 5fe1436a..7e8954c8 100644 --- a/com32/hdt/hdt-cli.c +++ b/com32/hdt/hdt-cli.c @@ -971,14 +971,10 @@ void start_cli_mode(struct s_hardware *hardware) /* Print the resulting buffer */ printf("%s", hdt_cli.input + hdt_cli.cursor_pos - 1); - /* Realing to the place we were */ - move_cursor_left(strlen(hdt_cli.input + hdt_cli.cursor_pos - 1)); - move_cursor_right(1); + /* Realing to a char before the place we were */ + hdt_cli.cursor_pos--; + move_cursor_to_column(strlen(hdt_cli.prompt)+hdt_cli.cursor_pos+1); - /* Don't decrement the position unless - * if we are at then end of the line*/ - if (hdt_cli.cursor_pos > (int)strlen(hdt_cli.input)) - hdt_cli.cursor_pos--; break; case KEY_F1: |