]> git.cameronkatri.com Git - mandoc.git/commitdiff
Bugfix: When a line ends with '\ \"', don't strip the trailing space
authorIngo Schwarze <schwarze@openbsd.org>
Sat, 18 Aug 2018 22:05:43 +0000 (22:05 +0000)
committerIngo Schwarze <schwarze@openbsd.org>
Sat, 18 Aug 2018 22:05:43 +0000 (22:05 +0000)
because that turned it into a bogus line continuation.

roff.c

diff --git a/roff.c b/roff.c
index bd8c8250a99b33678efabc6b2d18ad1611c8c735..0c7330061cb3ff05a803370dc4b387a75fa2e084 100644 (file)
--- a/roff.c
+++ b/roff.c
@@ -1,4 +1,4 @@
-/*     $Id: roff.c,v 1.334 2018/08/18 21:37:01 schwarze Exp $ */
+/*     $Id: roff.c,v 1.335 2018/08/18 22:05:43 schwarze Exp $ */
 /*
  * Copyright (c) 2008-2012, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
  * Copyright (c) 2010-2015, 2017, 2018 Ingo Schwarze <schwarze@openbsd.org>
@@ -1214,7 +1214,8 @@ roff_res(struct roff *r, struct buf *buf, int ln, int pos)
 
                /* Discard normal comments. */
 
-               while (stesc > start && stesc[-1] == ' ')
+               while (stesc > start && stesc[-1] == ' ' &&
+                   (stesc == start + 1 || stesc[-2] != '\\'))
                        stesc--;
                *stesc = '\0';
                break;