bug-ncurses
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 3/9] man/clear.1: Fix unescaped hyphens and backslash literals.


From: G. Branden Robinson
Subject: [PATCH 3/9] man/clear.1: Fix unescaped hyphens and backslash literals.
Date: Mon, 25 Sep 2023 15:00:24 -0500

* Use `\-` to get a copy-and-pastable hyphen-minus regardless of *roff
  output device.
* Use `\e` instead of `\\` to portably and robustly obtain a backslash
  in the output.

groff_man_style(7):

       \e     Format the current escape character on the output; widely
              used in man pages to render a backslash glyph.  It works
              reliably as long as the “.ec” request is not used, which
              should never happen in man pages, and it is slightly more
              portable than the more explicit \(rs (“reverse solidus”)
              special character escape sequence.

`\\` does not behave as a naïve *roff user expects when employed in a
macro or string definition.  *roff is not C.
---
 man/clear.1 | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/man/clear.1 b/man/clear.1
index c015b8da..bd561d88 100644
--- a/man/clear.1
+++ b/man/clear.1
@@ -114,7 +114,7 @@ .SH HISTORY
 and used this to replace the \fBclear\fP command with a shell script
 which calls \fBtput clear\fP, e.g.,
 .NS
-/usr/bin/tput ${1:+-T$1} clear 2> /dev/null
+/usr/bin/tput ${1:+\-T$1} clear 2> /dev/null
 exit
 .NE
 .PP
@@ -136,12 +136,12 @@ .SH HISTORY
 sequence for clearing the screen.
 Rather than clearing just the visible part of the screen using
 .NS
-printf \*'\\033[2J\*'
+printf \*'\e033[2J\*'
 .NE
 .IP
 one could clear the \fIscrollback\fP using
 .NS
-printf \*'\\033[\fB3\fPJ\*'
+printf \*'\e033[\fB3\fPJ\*'
 .NE
 .IP
 This is documented in \fIXTerm Control Sequences\fP as a feature originating
-- 
2.30.2

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]