source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* mdocml: In literal mode (.nf), each input line must be kept together  on
@ 2013-01-05 22:19 schwarze
  0 siblings, 0 replies; only message in thread
From: schwarze @ 2013-01-05 22:19 UTC (permalink / raw)
  To: source

Log Message:
-----------
In literal mode (.nf), each input line must be kept together 
on the same output line, even if it is longer than the output width.
This commit fixes a bug allowing an overly long last line of an 
indented block (.RS) to be broken even in literal mode.

The bug was found using the sudo_plugin(4) manual provided by millert@.

I introduced the bug in rev. 1.84 during the g2k12 Budapest hackathon.

Modified Files:
--------------
    mdocml:
        man_term.c

Revision Data
-------------
Index: man_term.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/man_term.c,v
retrieving revision 1.135
retrieving revision 1.136
diff -Lman_term.c -Lman_term.c -u -p -r1.135 -r1.136
--- man_term.c
+++ man_term.c
@@ -1,7 +1,7 @@
 /*	$Id$ */
 /*
  * Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
- * Copyright (c) 2010, 2011, 2012 Ingo Schwarze <schwarze@openbsd.org>
+ * Copyright (c) 2010, 2011, 2012, 2013 Ingo Schwarze <schwarze@openbsd.org>
  *
  * Permission to use, copy, modify, and distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
@@ -564,7 +564,7 @@ post_HP(DECL_ARGS)
 
 	switch (n->type) {
 	case (MAN_BODY):
-		term_flushln(p);
+		term_newln(p);
 		p->flags &= ~TERMP_NOBREAK;
 		p->flags &= ~TERMP_TWOSPACE;
 		p->offset = mt->offset;
@@ -1001,7 +1001,7 @@ out:
 	 * more specific than this.
 	 */
 	if (MANT_LITERAL & mt->fl && ! (TERMP_NOBREAK & p->flags) &&
-	    NULL != n->next && n->next->line > n->line) {
+	    (NULL == n->next || n->next->line > n->line)) {
 		rm = p->rmargin;
 		rmax = p->maxrmargin;
 		p->rmargin = p->maxrmargin = TERM_MAXMARGIN;
--
 To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2013-01-05 22:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-05 22:19 mdocml: In literal mode (.nf), each input line must be kept together on schwarze

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).