source@mandoc.bsd.lv
 help / color / mirror / Atom feed
From: schwarze@mandoc.bsd.lv
To: source@mandoc.bsd.lv
Subject: mandoc: Re-classify the roff(7) \r (reverse line feed) escape sequence
Date: Fri, 20 May 2022 08:09:16 -0500 (EST)	[thread overview]
Message-ID: <336534c77f3f6775@mandoc.bsd.lv> (raw)

Log Message:
-----------
Re-classify the roff(7) \r (reverse line feed) escape sequence
from "ignore" to "unsupported" because when an input file uses it,
mandoc(1) is likely to significantly misformat the output,
usually showing parts of the output in a different order
than the author intended.

Modified Files:
--------------
    mandoc:
        roff.7
        roff_escape.c
    mandoc/regress/roff/esc:
        Makefile

Added Files:
-----------
    mandoc/regress/roff/esc:
        r.in
        r.out_ascii
        r.out_lint

Revision Data
-------------
Index: roff.7
===================================================================
RCS file: /home/cvs/mandoc/mandoc/roff.7,v
retrieving revision 1.116
retrieving revision 1.117
diff -Lroff.7 -Lroff.7 -u -p -r1.116 -r1.117
--- roff.7
+++ roff.7
@@ -1,7 +1,7 @@
-.\"	$Id$
+.\" $Id$
 .\"
+.\" Copyright (c) 2010-2019, 2022 Ingo Schwarze <schwarze@openbsd.org>
 .\" Copyright (c) 2010, 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv>
-.\" Copyright (c) 2010-2019 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
@@ -2166,8 +2166,8 @@ Break the output line at the end of the 
 Set number register; ignored by
 .Xr mandoc 1 .
 .It Ic \er
-Move up by one line; ignored by
-.Xr mandoc 1 .
+Reverse line feed: move up by one output line.
+Currently unsupported.
 .It Ic \eS\(aq Ns Ar number Ns Ic \(aq
 Slant output; ignored by
 .Xr mandoc 1 .
Index: roff_escape.c
===================================================================
RCS file: /home/cvs/mandoc/mandoc/roff_escape.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -Lroff_escape.c -Lroff_escape.c -u -p -r1.1 -r1.2
--- roff_escape.c
+++ roff_escape.c
@@ -103,6 +103,7 @@ roff_escape(const char *buf, const int l
 
 	case '!':
 	case '?':
+	case 'r':
 		rval = ESCAPE_UNSUPP;
 		goto out;
 
@@ -114,7 +115,6 @@ roff_escape(const char *buf, const int l
 	case '^':
 	case 'a':
 	case 'd':
-	case 'r':
 	case 't':
 	case 'u':
 	case '{':
--- /dev/null
+++ regress/roff/esc/r.out_lint
@@ -0,0 +1 @@
+mandoc: r.in:11:7: UNSUPP: unsupported escape sequence: \r
--- /dev/null
+++ regress/roff/esc/r.out_ascii
@@ -0,0 +1,11 @@
+ESC-R(1)                    General Commands Manual                   ESC-R(1)
+
+N\bNA\bAM\bME\bE
+     e\bes\bsc\bc-\b-r\br - the roff reverse line feed escape sequence
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+     first line
+     beforeafter
+     last line
+
+OpenBSD                          May 20, 2022                          OpenBSD
Index: Makefile
===================================================================
RCS file: /home/cvs/mandoc/mandoc/regress/roff/esc/Makefile,v
retrieving revision 1.10
retrieving revision 1.11
diff -Lregress/roff/esc/Makefile -Lregress/roff/esc/Makefile -u -p -r1.10 -r1.11
--- regress/roff/esc/Makefile
+++ regress/roff/esc/Makefile
@@ -1,15 +1,16 @@
-# $OpenBSD: Makefile,v 1.20 2022/05/01 16:18:59 schwarze Exp $
+# $OpenBSD: Makefile,v 1.21 2022/05/20 13:06:27 schwarze Exp $
 
 REGRESS_TARGETS	 = one two multi comment
-REGRESS_TARGETS	+= B bs_man bs_mdoc c c_man E1 e f h hneg l O1 o p w z
+REGRESS_TARGETS	+= B bs_man bs_mdoc c c_man E1 e f h hneg l O1 o p r w z
 REGRESS_TARGETS	+= ignore invalid unsupp
 HTML_TARGETS	 = f
-LINT_TARGETS	 = comment B h l O1 w ignore invalid unsupp
+LINT_TARGETS	 = comment B h l O1 r w ignore invalid unsupp
 
-# mandoc defect:
+# mandoc defects:
 # - \h with a negative argument replaces output characters
 #   instead of overstriking them
+# - \r does not return to the previous output line
 
-SKIP_GROFF	 = hneg
+SKIP_GROFF	 = hneg r
 
 .include <bsd.regress.mk>
--- /dev/null
+++ regress/roff/esc/r.in
@@ -0,0 +1,13 @@
+.\" $OpenBSD: r.in,v 1.1 2022/05/20 13:06:27 schwarze Exp $
+.Dd $Mdocdate: May 20 2022 $
+.Dt ESC-R 1
+.Os
+.Sh NAME
+.Nm esc-r
+.Nd the roff reverse line feed escape sequence
+.Sh DESCRIPTION
+.Bd -literal
+first line
+before\rafter
+last line
+.Ed
--
 To unsubscribe send an email to source+unsubscribe@mandoc.bsd.lv


                 reply	other threads:[~2022-05-20 13:09 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=336534c77f3f6775@mandoc.bsd.lv \
    --to=schwarze@mandoc.bsd.lv \
    --cc=source@mandoc.bsd.lv \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).