From a5180eeb8d02b68fe32fdb9192e1e2097e059132 Mon Sep 17 00:00:00 2001 From: John Ankarstrom Date: Thu, 8 Jul 2021 22:24:39 +0200 Subject: Add editors/nvi/patch-single-space --- editors/nvi/patch-single-space | 87 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 editors/nvi/patch-single-space (limited to 'editors') diff --git a/editors/nvi/patch-single-space b/editors/nvi/patch-single-space new file mode 100644 index 0000000..cd4e5b1 --- /dev/null +++ b/editors/nvi/patch-single-space @@ -0,0 +1,87 @@ +$NetBSD + +Use single-spaced sentences. + +--- ex/ex_join.c.orig 2021-07-08 22:08:40.673156442 +0200 ++++ ex/ex_join.c +@@ -36,7 +36,7 @@ ex_join(SCR *sp, EXCMD *cmdp) + { + db_recno_t from, to; + size_t blen, clen, len, tlen; +- int echar, extra, first; ++ int echar, first; + CHAR_T *bp, *tbp; + CHAR_T *p; + +@@ -92,8 +92,6 @@ ex_join(SCR *sp, EXCMD *cmdp) + * If the current line ends with whitespace, strip leading + * whitespace from the joined line. + * If the next line starts with a ), do nothing. +- * If the current line ends with ., insert two spaces. +- * Else, insert one space. + * + * One change -- add ? and ! to the list of characters for + * which we insert two spaces. I expect that POSIX 1003.2 +@@ -101,16 +99,10 @@ ex_join(SCR *sp, EXCMD *cmdp) + * + * Echar is the last character in the last line joined. + */ +- extra = 0; + if (!first && !FL_ISSET(cmdp->iflags, E_C_FORCE)) { + if (isblank(echar)) + for (; len && isblank(*p); --len, ++p); + else if (p[0] != ')') { +- if (strchr(".?!", echar)) { +- *tbp++ = ' '; +- ++clen; +- extra = 1; +- } + *tbp++ = ' '; + ++clen; + for (; len && isblank(*p); --len, ++p); +@@ -145,10 +137,10 @@ ex_join(SCR *sp, EXCMD *cmdp) + * line. + */ + if (first) { +- sp->cno = (tbp - bp) - (1 + extra); ++ sp->cno = (tbp - bp) - 1; + first = 0; + } else +- sp->cno = (tbp - bp) - len - (1 + extra); ++ sp->cno = (tbp - bp) - len - 1; + } + sp->lno = cmdp->addr1.lno; + +--- vi/v_sentence.c.orig 2021-07-08 22:08:40.701042615 +0200 ++++ vi/v_sentence.c +@@ -39,10 +39,10 @@ static const char sccsid[] = "$Id: v_sentence.c,v 10.9 2001/06/25 15:19:35 skimo + * counts consistently, mostly in the presence of lines containing only + * white-space characters. + * +- * This implementation also permits a single tab to delimit sentences, and +- * treats lines containing only white-space characters as empty lines. +- * Finally, tabs are eaten (along with spaces) when skipping to the start +- * of the text following a "sentence". ++ * This implementation also permits a single space or tab to delimit ++ * sentences, and treats lines containing only white-space characters as ++ * empty lines. Finally, tabs are eaten (along with spaces) when skipping ++ * to the start of the text following a "sentence". + */ + + /* +@@ -124,14 +124,9 @@ v_sentencef(SCR *sp, VICMD *vp) + state = NONE; + break; + case '\t': +- if (state == PERIOD) +- state = BLANK; +- /* FALLTHROUGH */ + case ' ': +- if (state == PERIOD) { ++ if (state == PERIOD) + state = BLANK; +- break; +- } + if (state == BLANK && --cnt == 0) { + if (cs_fblank(sp, &cs)) + return (1); -- cgit v1.2.3