From 752fbc480cbfde768f659df33231522f7fc396c3 Mon Sep 17 00:00:00 2001 From: "G. Branden Robinson" Date: Fri, 12 Aug 2022 22:43:03 -0500 Subject: [PATCH] troff: support `\~` as an alias for `\ ` In groff, Heirloom Doctools troff, and neatroff, the `\~` escape sequence produces an adjustable (paddable) but unbreakable space. mandoc, which does not perform adjustment or render to typesetters, supports the escape sequence as a synonym for `\ `, the same as `\0`. This extension is of long pedigree: groff has supported it for at least 30 years, Heirloom for 17, mandoc for 13, and neatroff for 6. Do the same as mandoc to prevent mis-rendering of documents using this escape sequence. Heirloom Doctools troff, a descendant of Documenter's Workbench troff, would be a good place to look for a compatible implementation of the adjustable semantics for this sequence. --- usr/src/cmd/troff/n1.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/usr/src/cmd/troff/n1.c b/usr/src/cmd/troff/n1.c index f1f2f001343e..a003ea77a9af 100644 --- a/usr/src/cmd/troff/n1.c +++ b/usr/src/cmd/troff/n1.c @@ -850,6 +850,8 @@ getch() case 'e': /* printable version of current eschar */ i = PRESC; goto gx; + case '~': /* Heirloom/groff/neatroff: unbreakable space */ + ; /* fall through */ case ' ': /* unpaddable space */ i = UNPAD; goto gx;