Skip to content

Commit

Permalink
Treat consecutive paragraph indicators as different paragraphs (#119)
Browse files Browse the repository at this point in the history
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.

Closes: #118
See also: https://marc.info/?l=openbsd-bugs&m=169100763926909&w=2
  • Loading branch information
lichray authored Aug 29, 2023
1 parent 2f45b17 commit 517d821
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions vi/v_paragraph.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,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; \
} \
} while (0)

/*
Expand Down

0 comments on commit 517d821

Please sign in to comment.