This diff allows a single space for sentence delimitation.
ok/comments/objections? The default of a double space is left as is.
mark
Index: def.h
===
RCS file: /cvs/src/usr.bin/mg/def.h,v
retrieving revision 1.154
diff -u -p -u -p -r1.154 def.h
--- def.h 2 Jan 2016 10:39:19 - 1.154
+++ def.h 12 Apr 2016 18:01:57 -
@@ -593,6 +593,7 @@ int fillword(int, int);
int setfillcol(int, int);
int markpara(int, int);
int transposepara(int, int);
+int sentencespace(int, int);
/* word.c X */
int backword(int, int);
@@ -734,6 +735,7 @@ extern int defb_nmodes;
extern int defb_flag;
extern int doaudiblebell;
extern int dovisiblebell;
+extern int dblspace;
extern char cinfo[];
extern char*keystrings[];
extern char pat[NPAT];
Index: funmap.c
===
RCS file: /cvs/src/usr.bin/mg/funmap.c,v
retrieving revision 1.52
diff -u -p -u -p -r1.52 funmap.c
--- funmap.c29 Dec 2015 19:44:32 - 1.52
+++ funmap.c12 Apr 2016 18:01:57 -
@@ -180,6 +180,7 @@ static struct funmap functnames[] = {
{backsearch, "search-backward",},
{forwsearch, "search-forward",},
{selfinsert, "self-insert-command",},
+ {sentencespace, "sentence-end-double-space",},
#ifdef REGEX
{setcasefold, "set-case-fold-search",},
#endif /* REGEX */
Index: main.c
===
RCS file: /cvs/src/usr.bin/mg/main.c,v
retrieving revision 1.81
diff -u -p -u -p -r1.81 main.c
--- main.c 24 Dec 2015 09:07:47 - 1.81
+++ main.c 12 Apr 2016 18:01:57 -
@@ -27,6 +27,7 @@ intcurgoal; /* goal column
*/
int startrow; /* row to start */
int doaudiblebell; /* audible bell toggle */
int dovisiblebell; /* visible bell toggle */
+int dblspace; /* sentence end #spaces */
struct buffer *curbp; /* current buffer */
struct buffer *bheadp;/* BUFFER list head */
struct mgwin *curwp; /* current window */
@@ -109,6 +110,7 @@ main(int argc, char **argv)
edinit(bp); /* Buffers, windows.*/
ttykeymapinit();/* Symbols, bindings. */
bellinit(); /* Audible and visible bell.*/
+ dblspace = 1; /* two spaces for sentence end. */
/*
* doing update() before reading files causes the error messages from
Index: mg.1
===
RCS file: /cvs/src/usr.bin/mg/mg.1,v
retrieving revision 1.103
diff -u -p -u -p -r1.103 mg.1
--- mg.117 Mar 2016 21:56:12 - 1.103
+++ mg.112 Apr 2016 18:01:58 -
@@ -838,6 +838,10 @@ If found, dot gets moved to just after t
characters, if not found, print a message.
.It self-insert-command
Insert a character.
+.It sentence-end-double-space
+Toggle double or single spaces for end of sentences.
+Double is the default.
+Currently only affects fill-paragraph.
.It set-case-fold-search
Set case-fold searching, causing case not to matter
in regular expression searches.
Index: paragraph.c
===
RCS file: /cvs/src/usr.bin/mg/paragraph.c,v
retrieving revision 1.43
diff -u -p -u -p -r1.43 paragraph.c
--- paragraph.c 12 Apr 2016 06:20:50 - 1.43
+++ paragraph.c 12 Apr 2016 18:01:58 -
@@ -208,12 +208,12 @@ fillpara(int f, int n)
* behave the same way if a ')' is preceded by a
* [.?!] and followed by a doublespace.
*/
- if (!eopflag && ((eolflag ||
+ if (dblspace && (!eopflag && ((eolflag ||
curwp->w_doto == llength(curwp->w_dotp) ||
(c = lgetc(curwp->w_dotp, curwp->w_doto)) == ' '
|| c == '\t') && (ISEOSP(wbuf[wordlen - 1]) ||
(wbuf[wordlen - 1] == ')' && wordlen >= 2 &&
- ISEOSP(wbuf[wordlen - 2]))) &&
+ ISEOSP(wbuf[wordlen - 2] &&
wordlen < MAXWORD - 1))
wbuf[wordlen++] = ' ';
@@ -480,5 +480,16 @@ setfillcol(int f, int n)
fillcol = nfill;
ewprintf("Fill column set to %d", fillcol);
}
+ return (TRUE);
+}
+
+int
+sentencespace(int f, int n)
+{
+ if (f & FFARG)
+ dblspace = n > 1;
+ else