1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
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);
|