PR/44006: Ralph G: vi: CTRL-A does not handle end-of-word correctly

End-of-word was not included in search regexp leading to false positives.
http://patches.ubuntu.com/by-release/extracted/debian/n/nvi/1.81.6-7/15search_word.dpatch
This commit is contained in:
christos 2010-10-28 18:12:47 +00:00
parent b6050c6897
commit cefc0995de

View File

@ -1,4 +1,4 @@
/* $NetBSD: v_search.c,v 1.2 2008/12/05 22:51:43 christos Exp $ */
/* $NetBSD: v_search.c,v 1.3 2010/10/28 18:12:47 christos Exp $ */
/*-
* Copyright (c) 1992, 1993, 1994
@ -324,15 +324,16 @@ int
v_searchw(SCR *sp, VICMD *vp)
{
size_t blen, len;
size_t olen = STRLEN(VIP(sp)->keyw);
int rval;
CHAR_T *bp, *p;
len = VIP(sp)->klen + RE_WSTART_LEN + RE_WSTOP_LEN;
len = olen + RE_WSTART_LEN + RE_WSTOP_LEN;
GET_SPACE_RETW(sp, bp, blen, len);
MEMCPY(bp, RE_WSTART, RE_WSTART_LEN);
p = bp + RE_WSTART_LEN;
MEMCPY(p, VIP(sp)->keyw, VIP(sp)->klen);
p += VIP(sp)->klen;
MEMCPY(p, VIP(sp)->keyw, olen);
p += olen;
MEMCPY(p, RE_WSTOP, RE_WSTOP_LEN);
rval = v_search(sp, vp, bp, len, SEARCH_SET, FORWARD);