diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2019-01-03 19:59:55 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2019-01-03 19:59:55 +0000 |
commit | 9f4d60709725128fb9c4b5cd5918325ff4dd397f (patch) | |
tree | 6fcac57abb031ca34bb9449d6fac740eab172330 /test-dirent-namlen.c | |
parent | 296e5bf4695364984a7f038bb773183a4b86de57 (diff) | |
download | mandoc-9f4d60709725128fb9c4b5cd5918325ff4dd397f.tar.gz |
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 'test-dirent-namlen.c')
0 files changed, 0 insertions, 0 deletions