summaryrefslogtreecommitdiffstats
path: root/usr.bin/mandoc/man_term.c
diff options
context:
space:
mode:
authorschwarze <schwarze@openbsd.org>2019-01-03 19:59:11 +0000
committerschwarze <schwarze@openbsd.org>2019-01-03 19:59:11 +0000
commit3139a193289d5e1ae2f0b6f5429cb93701ab2778 (patch)
treee91b5eefb95491cd8cf79cba41a646b5d306d21f /usr.bin/mandoc/man_term.c
parentCrank MAXTSIZ to next pow2 (256MB) because a few piggy binaries (diff)
downloadwireguard-openbsd-3139a193289d5e1ae2f0b6f5429cb93701ab2778.tar.xz
wireguard-openbsd-3139a193289d5e1ae2f0b6f5429cb93701ab2778.zip
Rewrite the line filling function for terminal output yet again.
This function has always been among the most complicated parts of mandoc, and it repeatedly needed substantial functional enhancements. The present rewrite is required to prepare for the implementation of simultaneous filling and centering of output lines. The previous implementation looked at each word in turn and printed it to the output stream as soon as it was found to still fit on the current output line. Obviously, that approach neither allows centering nor adjustment to the right margin. The new implementation first decides which part of the paragraph to put onto the current output line, also measuring the display width of that part, even if that part consists of multiple words including intervening whitespace. This will allow moving the whole output line to the right as desired before printing it, for example to center it or to adjust it to the right margin. The function is split into three parts, each much shorter, solving a better defined task, much easier to understand and better commented: 1. the steering function term_flushln() looping over output lines; 2. the calculation function term_fill() looping over input characters; 3. and the output function term_field() looping over printed characters. No functional change yet.
Diffstat (limited to 'usr.bin/mandoc/man_term.c')
0 files changed, 0 insertions, 0 deletions