aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmdedit.c11
-rw-r--r--shell/cmdedit.c11
2 files changed, 20 insertions, 2 deletions
diff --git a/cmdedit.c b/cmdedit.c
index 5cd43ae2a..515685f55 100644
--- a/cmdedit.c
+++ b/cmdedit.c
@@ -143,6 +143,12 @@ void input_backspace(char* command, int outputFd, int *cursor, int *len)
143{ 143{
144 int j = 0; 144 int j = 0;
145 145
146/* Debug crap */
147//fprintf(stderr, "\nerik: len=%d, cursor=%d, strlen(command)='%d'\n", *len, *cursor, strlen(command));
148//xwrite(outputFd, command, *len);
149//*cursor = *len;
150
151
146 if (*cursor > 0) { 152 if (*cursor > 0) {
147 xwrite(outputFd, "\b \b", 3); 153 xwrite(outputFd, "\b \b", 3);
148 --*cursor; 154 --*cursor;
@@ -534,7 +540,10 @@ extern void cmdedit_read_input(char* prompt, char command[BUFSIZ])
534 rewrite_line: 540 rewrite_line:
535 /* erase old command from command line */ 541 /* erase old command from command line */
536 len = strlen(command)-strlen(hp->s); 542 len = strlen(command)-strlen(hp->s);
537 while (len>0) 543
544 while (len>cursor)
545 input_delete(command, outputFd, cursor, &len);
546 while (cursor>0)
538 input_backspace(command, outputFd, &cursor, &len); 547 input_backspace(command, outputFd, &cursor, &len);
539 input_home(outputFd, &cursor); 548 input_home(outputFd, &cursor);
540 549
diff --git a/shell/cmdedit.c b/shell/cmdedit.c
index 5cd43ae2a..515685f55 100644
--- a/shell/cmdedit.c
+++ b/shell/cmdedit.c
@@ -143,6 +143,12 @@ void input_backspace(char* command, int outputFd, int *cursor, int *len)
143{ 143{
144 int j = 0; 144 int j = 0;
145 145
146/* Debug crap */
147//fprintf(stderr, "\nerik: len=%d, cursor=%d, strlen(command)='%d'\n", *len, *cursor, strlen(command));
148//xwrite(outputFd, command, *len);
149//*cursor = *len;
150
151
146 if (*cursor > 0) { 152 if (*cursor > 0) {
147 xwrite(outputFd, "\b \b", 3); 153 xwrite(outputFd, "\b \b", 3);
148 --*cursor; 154 --*cursor;
@@ -534,7 +540,10 @@ extern void cmdedit_read_input(char* prompt, char command[BUFSIZ])
534 rewrite_line: 540 rewrite_line:
535 /* erase old command from command line */ 541 /* erase old command from command line */
536 len = strlen(command)-strlen(hp->s); 542 len = strlen(command)-strlen(hp->s);
537 while (len>0) 543
544 while (len>cursor)
545 input_delete(command, outputFd, cursor, &len);
546 while (cursor>0)
538 input_backspace(command, outputFd, &cursor, &len); 547 input_backspace(command, outputFd, &cursor, &len);
539 input_home(outputFd, &cursor); 548 input_home(outputFd, &cursor);
540 549