Hi, I think I got it.
On Wed, Aug 02, 2023 at 08:14:01PM +0200, Walter Alejandro Iglesias wrote: > Running latest snapshot. > > Acording to vi(1): > > [count] } > Move forward count paragraphs. > > [...] > > paragraphs, para [IPLPPPQPP LIpplpipbpBlBdPpLpIt] > vi only. Define additional paragraph boundaries for the { and } > commands. > > The bug: > > Using the move forward with paragraphs separated by tags (those in > 'para' options) as in the example below doesn't move the cursor to the > right place. > 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 17 Aug 2023 08:29:53 -0000 @@ -107,11 +107,9 @@ v_paragraphf(SCR *sp, VICMD *vp) * (2 * N - 1) times, in non-text, (2 * N) times. */ cnt = F_ISSET(vp, VC_C1SET) ? vp->count : 1; - cnt *= 2; if (len == 0 || v_isempty(p, len)) pstate = P_INBLANK; else { - --cnt; pstate = P_INTEXT; } @@ -125,6 +123,7 @@ v_paragraphf(SCR *sp, VICMD *vp) INTEXT_CHECK; break; case P_INBLANK: + ++cnt; if (len == 0 || v_isempty(p, len)) break; if (--cnt) { @@ -251,11 +250,9 @@ v_paragraphb(SCR *sp, VICMD *vp) * (2 * N - 1) times, in non-text, (2 * N) times. */ cnt = F_ISSET(vp, VC_C1SET) ? vp->count : 1; - cnt *= 2; if (len == 0 || v_isempty(p, len)) pstate = P_INBLANK; else { - --cnt; pstate = P_INTEXT; /* @@ -275,6 +272,7 @@ v_paragraphb(SCR *sp, VICMD *vp) INTEXT_CHECK; break; case P_INBLANK: + ++cnt; if (len != 0 && !v_isempty(p, len)) { if (!--cnt) goto found; -- Walter