This diff changes mg's behaviour to not put a space at the end of a
paragraph when using the fill-paragraph function as reported by Harald
Dunkel. ok/comments? 

 
Index: paragraph.c
===================================================================
RCS file: /cvs/src/usr.bin/mg/paragraph.c,v
retrieving revision 1.42
diff -u -p -u -p -r1.42 paragraph.c
--- paragraph.c 14 Dec 2015 03:25:59 -0000      1.42
+++ paragraph.c 3 Apr 2016 19:45:19 -0000
@@ -208,13 +208,13 @@ fillpara(int f, int n)
                         * behave the same way if a ')' is preceded by a
                         * [.?!] and followed by a doublespace.
                         */
-                       if ((eolflag ||
+                       if (!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]))) &&
-                           wordlen < MAXWORD - 1)
+                           wordlen < MAXWORD - 1))
                                wbuf[wordlen++] = ' ';
 
                        /* at a word break with a word waiting */

Reply via email to