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.
Example:
Open with vi(1) a file containing the following lines. Put your cursor at the '1' or in the empty line right above, and try using '}' (move to next paragraph) with different number prefixes (placing again the cursor at "1" each time).
1
2
3
4
5
6
There it works as expected. Now repeat the same on these lines (keeping paragraphs option untouched):
.PP
1
.PP
2
.PP
3
.PP
4
.PP
5
.PP
6
The prefixes in this case will move your cursor to "prefix + prefix - 1" paragraphs. This is:
2 will move your cursor to 3
3 will move your cursor to 5
4 to 7
5 to 9
and so on.
Finally, repeat the same steps on these lines:
.PP 1
.PP 2
.PP 3
.PP 4
.PP 5
.PP 6
.PP 7
.PP 8
Now the cursor will go "prefix *= 2"
It behaves in the same fashion moving to previous paragraphs.
I took a look to this file:
/usr/src/usr.bin/vi/vi/v_paragraph.c
But I wasn't able to understand what it does. Especially this part:
/*
* If we start in text, we want to switch states
* (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;
}
Reported by: Walter Alejandro Iglesias wai@roquesor.com
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.
Example:
Open with vi(1) a file containing the following lines. Put your cursor at the '1' or in the empty line right above, and try using '}' (move to next paragraph) with different number prefixes (placing again the cursor at "1" each time).
There it works as expected. Now repeat the same on these lines (keeping paragraphs option untouched):
The prefixes in this case will move your cursor to "prefix + prefix - 1" paragraphs. This is:
and so on.
Finally, repeat the same steps on these lines:
Now the cursor will go "prefix *= 2"
It behaves in the same fashion moving to previous paragraphs.
I took a look to this file:
But I wasn't able to understand what it does. Especially this part: