Changed bb_regcomp to xregcomp and #if 0'ed out destroy_cmd_strs in sed.c
[oweals/busybox.git] / cmdedit.c
index e4c88c265ac744165d475cb5f3cced4cf2973581..515685f553eedc2fcd62ac5957000f6f9430af35 100644 (file)
--- a/cmdedit.c
+++ b/cmdedit.c
@@ -70,6 +70,12 @@ static struct history *his_end = NULL;       /* Last element in command line list */
 
 /* Current termio and the previous termio before starting sh */
 struct termios initial_settings, new_settings;
+
+
+#ifndef        _POSIX_VDISABLE
+#define        _POSIX_VDISABLE '\0'
+#endif
+
 #endif
 
 
@@ -137,6 +143,12 @@ void input_backspace(char* command, int outputFd, int *cursor, int *len)
 {
        int j = 0;
 
+/* Debug crap */
+//fprintf(stderr, "\nerik: len=%d, cursor=%d, strlen(command)='%d'\n", *len, *cursor, strlen(command));
+//xwrite(outputFd, command, *len);
+//*cursor = *len;
+
+
        if (*cursor > 0) {
                xwrite(outputFd, "\b \b", 3);
                --*cursor;
@@ -266,7 +278,7 @@ void input_tab(char* command, char* prompt, int outputFd, int *cursor, int *len)
 
                /* For now, we will not bother with trying to distinguish
                 * whether the cursor is in/at a command extression -- we
-                * will always try all possable matches.  If you don't like
+                * will always try all possible matches.  If you don't like
                 * that then feel free to fix it.
                 */
 
@@ -528,7 +540,10 @@ extern void cmdedit_read_input(char* prompt, char command[BUFSIZ])
                                          rewrite_line:
                                                /* erase old command from command line */
                                                len = strlen(command)-strlen(hp->s);
-                                               while (len>0)
+
+                                               while (len>cursor)
+                                                       input_delete(command, outputFd, cursor, &len);
+                                               while (cursor>0)
                                                        input_backspace(command, outputFd, &cursor, &len);
                                                input_home(outputFd, &cursor);