diff options
author | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2019-01-03 19:59:12 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2019-01-03 19:59:12 +0000 |
commit | f30034c7f96d3e4cbd0c5d2ee081b5f7a02a2bd4 (patch) | |
tree | 42f86e4c849b572411a6b753ea8b4c9982aa365e /sbin/mount_cd9660 | |
parent | 030f17b7bff09e7bf80c8f8eee790f3427a5ed10 (diff) |
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 'sbin/mount_cd9660')
0 files changed, 0 insertions, 0 deletions