fix a vi mode segfault when using ^W during a search; from multiplexd

This commit is contained in:
tg 2018-07-15 16:16:38 +00:00
parent 5dab09d6a8
commit 008f09dd09
1 changed files with 2 additions and 2 deletions

4
edit.c
View File

@ -28,7 +28,7 @@
#ifndef MKSH_NO_CMDLINE_EDITING #ifndef MKSH_NO_CMDLINE_EDITING
__RCSID("$MirOS: src/bin/mksh/edit.c,v 1.342 2018/01/14 00:03:00 tg Exp $"); __RCSID("$MirOS: src/bin/mksh/edit.c,v 1.343 2018/07/15 16:16:38 tg Exp $");
/* /*
* in later versions we might use libtermcap for this, but since external * in later versions we might use libtermcap for this, but since external
@ -3831,7 +3831,7 @@ vi_hook(int ch)
vs = save_es; vs = save_es;
i = (unsigned)srchlen; i = (unsigned)srchlen;
while (--i >= n) while (i-- > n)
vs->linelen -= char_len(locpat[i]); vs->linelen -= char_len(locpat[i]);
srchlen = (int)n; srchlen = (int)n;
vs->cursor = vs->linelen; vs->cursor = vs->linelen;