diff options
author | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2023-10-23 20:07:20 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2023-10-23 20:07:20 +0000 |
commit | 40ebced4aadbadd803f65503d4b5ca35172438e6 (patch) | |
tree | 89d7dc07adc580d303fe10747ee190713fad9124 /share/man | |
parent | 32a77ac6379b61e745f0049e506665ad26cd1ab5 (diff) |
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 <Eggert at cs dot ucla dot edu>, 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.
Diffstat (limited to 'share/man')
-rw-r--r-- | share/man/man7/roff.7 | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/share/man/man7/roff.7 b/share/man/man7/roff.7 index 3e0dd7b1bed..f92a9c295c1 100644 --- a/share/man/man7/roff.7 +++ b/share/man/man7/roff.7 @@ -1,6 +1,6 @@ -.\" $OpenBSD: roff.7,v 1.101 2022/05/31 20:21:40 schwarze Exp $ +.\" $OpenBSD: roff.7,v 1.102 2023/10/23 20:07:18 schwarze Exp $ .\" -.\" Copyright (c) 2010-2019, 2022 Ingo Schwarze <schwarze@openbsd.org> +.\" Copyright (c) 2010-2019, 2022-2023 Ingo Schwarze <schwarze@openbsd.org> .\" Copyright (c) 2010, 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv> .\" .\" Permission to use, copy, modify, and distribute this software for any @@ -15,7 +15,7 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: May 31 2022 $ +.Dd $Mdocdate: October 23 2023 $ .Dt ROFF 7 .Os .Sh NAME @@ -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 |