From 18c87ef68c91b81051bd58c31019aa7c8983ce80 Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Mon, 23 Oct 2023 20:25:02 +0000 Subject: Support some escape sequences, in particular character escape sequences, inside \w arguments, and skip most other escape sequences when measuring the output length in this way because most escape sequences contribute little or nothing to text width: for example, consider font escapes in terminal output. This implementation is very rudimentary. In particular, it assumes that every character has the same width. No attempt is made to detect double-width or zero-width Unicode characters or to take dependencies on output devices or fonts into account. These limitations are hard to avoid because mandoc has to interpolate \w at the parsing stage when the output device is not yet known. I really do not want the content of the syntax tree to depend on the output device. Feature requested by Paul , who also submitted a patch, but i chose to commit this very different patch with almost the same functionality. His input was still very valuable because complete support for \w is out of the question, and consequently, the main task is identifying subsets of the feature that are needed for real-world manual pages and can be supported without uprooting the whole forest. --- roff.7 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'roff.7') diff --git a/roff.7 b/roff.7 index 597d4aa7..22459a9c 100644 --- a/roff.7 +++ b/roff.7 @@ -1,6 +1,6 @@ .\" $Id$ .\" -.\" Copyright (c) 2010-2019, 2022 Ingo Schwarze +.\" Copyright (c) 2010-2019, 2022-2023 Ingo Schwarze .\" Copyright (c) 2010, 2011, 2012 Kristaps Dzonsons .\" .\" Permission to use, copy, modify, and distribute this software for any @@ -2224,7 +2224,8 @@ The .Xr mandoc 1 implementation assumes that after expansion of user-defined strings, the .Ar string -only contains normal characters, no escape sequences, and that each +only contains normal characters, characters expressed as escape sequences, +and zero-width escape sequences, and that each character has a width of 24 basic units. .It Ic \eX\(aq Ns Ar string Ns Ic \(aq Output -- cgit