lineedit: fix Alt-D when cursor==0
authorCliff Frey <cliff@meraki.com>
Tue, 7 Aug 2012 15:59:40 +0000 (17:59 +0200)
committerDenys Vlasenko <vda.linux@googlemail.com>
Tue, 7 Aug 2012 15:59:40 +0000 (17:59 +0200)
Signed-off-by: Cliff Frey <cliff@meraki.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
libbb/lineedit.c

index b89748a1c64f4df14e003e2649ac95cd138e479e..92bea856e4bd9fcb70222726f2ab8d673ae76a2d 100644 (file)
@@ -2527,9 +2527,9 @@ int FAST_FUNC read_line_input(line_input_t *st, const char *prompt, char *comman
                                        /* Delete word forward */
                                        int nc, sc = cursor;
                                        ctrl_right();
-                                       nc = cursor;
-                                       input_backward(cursor - sc);
-                                       while (--nc >= cursor)
+                                       nc = cursor - sc;
+                                       input_backward(nc);
+                                       while (--nc >= 0)
                                                input_delete(1);
                                        break;
                                }