[BACK]Return to w.out_ascii CVS log [TXT][DIR] Up to [cvsweb.bsd.lv] / mandoc / regress / roff / esc

File: [cvsweb.bsd.lv] / mandoc / regress / roff / esc / w.out_ascii (download)

Revision 1.4, Mon Oct 23 20:25:03 2023 UTC (7 months, 3 weeks ago) by schwarze
Branch: MAIN
CVS Tags: HEAD
Changes since 1.3: +8 -1 lines

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.

ESC-W(1)                    General Commands Manual                   ESC-W(1)

NNAAMMEE
     eesscc--ww - the roff escape w sequence: text width

DDEESSCCRRIIPPTTIIOONN
     empty: 0
     character: 24
     blank: 24
     text: 96
     special: 24
     numbered: 24
     Unicode: 24
     overstrike: 24
     undefined: 24
     zero-width: 0
     skipchar: 48

   AArrgguummeenntt ddeelliimmiitteerrss
     unsupported \r: 24u
     ignored \&: 24u
     useless \.: 24u
     invalid \G: 24u
     special \-: 24u
     break \p: 24u
     nospace \c: 24u
     string expansion: 24u
     register expansion: 24u
     ignored \ON: 24u
     special character: 24u
     ignored \Z'str': 24u
     horizontal motion: 24u
     horizontal line: 24u
     overstrike: 24u
     unterminated: 72

OpenBSD                        October 23, 2023                        OpenBSD