On Thu, Sep 07, 2023 at 09:04:43AM +0200, Walter Alejandro Iglesias wrote: > Dear OpenBSD developers, > > On Aug 2 I reported this bug: > > https://marc.info/?l=openbsd-bugs&m=169100763926909&w=2 > > After fiddling around I found a solution that works for both vi base and > nvi from ports: > > https://marc.info/?l=openbsd-bugs&m=169269999218514&w=2 > > Since nobody answered me in bugs@ I sent a message to ports@ and Cc: > Anthony J. Bentley who told me to contact Zhihao Yuan, nvi developer > upstream. I don't use github, I don't have a github account, luckily > after searching the web I found an email address of Zhihao. He > understood the issue and answered me with what seems to be a more > consistent patch: > > https://marc.info/?l=openbsd-bugs&m=169277277928008&w=2 > > Which, needless to say, also works for both. vi on base and nvi on > ports. Below I paste a cvs version of Zhihao's patch to use it with vi > on base. > > So it only rests some OpenBSD developer here to take look. It's not > going to take up much of your time, everything has already been chewed > up :-).
Thanks for the detailed bug report and fix! Committed. > > > Zhihao's diff translated to cvs: > > Index: vi/v_paragraph.c > =================================================================== > RCS file: /cvs/src/usr.bin/vi/vi/v_paragraph.c,v > retrieving revision 1.9 > diff -u -p -r1.9 v_paragraph.c > --- vi/v_paragraph.c 18 Apr 2017 01:45:35 -0000 1.9 > +++ vi/v_paragraph.c 23 Aug 2023 10:18:39 -0000 > @@ -41,15 +41,20 @@ > if (p[0] == '\014') { \ > if (!--cnt) \ > goto found; \ > + if (pstate == P_INTEXT && !--cnt) \ > + goto found; \ > continue; \ > } \ > if (p[0] != '.' || len < 2) \ > continue; \ > for (lp = VIP(sp)->ps; *lp != '\0'; lp += 2) \ > if (lp[0] == p[1] && \ > - ((lp[1] == ' ' && len == 2) || lp[1] == p[2]) && \ > - !--cnt) \ > - goto found; \ > + (lp[1] == ' ' && len == 2 || lp[1] == p[2])) { \ > + if (!--cnt) \ > + goto found; \ > + if (pstate == P_INTEXT && !--cnt) \ > + goto found; \ > + } \ > } > > /* > > > -- > Walter >