menu: fix Ctrl-W (word erase) when editing a command line
authorH. Peter Anvin <hpa@zytor.com>
Fri, 14 Aug 2009 05:31:13 +0000 (22:31 -0700)
committerH. Peter Anvin <hpa@zytor.com>
Fri, 14 Aug 2009 05:31:13 +0000 (22:31 -0700)
The Ctrl-W (word erase) key was broken: it would think the command
line got longer, not shorter, resulting in havoc.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
com32/menu/menumain.c

index 82f0018..5b568fe 100644 (file)
@@ -527,7 +527,7 @@ static const char *edit_cmdline(const char *input, int top)
 
                memmove(cmdline + cursor, cmdline + prevcursor,
                        len - prevcursor + 1);
-               len -= (cursor - prevcursor);
+               len -= (prevcursor - cursor);
                redraw = 1;
            }
            break;