From: tobhe Date: Thu, 7 Sep 2023 11:17:32 +0000 (+0000) Subject: Treat consecutive paragraph indicators as different paragraphs X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=57651b989732fe71e698cb13c8007c9650fe78b9;p=openbsd Treat consecutive paragraph indicators as different paragraphs Consecutive empty lines count toward the same state, so there're 2x states (to get in and out). ^L and .PP are counted as text, hitting those in the text should be treated as getting out of a paragraph and then getting in. From Walter Alejandro Iglesias and Zhihao Yuan in nvi2 ok bluhm@ --- diff --git a/usr.bin/vi/vi/v_paragraph.c b/usr.bin/vi/vi/v_paragraph.c index 23efd73904f..77422b080cc 100644 --- a/usr.bin/vi/vi/v_paragraph.c +++ b/usr.bin/vi/vi/v_paragraph.c @@ -1,4 +1,4 @@ -/* $OpenBSD: v_paragraph.c,v 1.9 2017/04/18 01:45:35 deraadt Exp $ */ +/* $OpenBSD: v_paragraph.c,v 1.10 2023/09/07 11:17:32 tobhe Exp $ */ /*- * Copyright (c) 1992, 1993, 1994 @@ -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; \ + } \ } /*