aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/test-vasprintf.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2019-01-03 19:59:55 +0000
committerIngo Schwarze <schwarze@openbsd.org>2019-01-03 19:59:55 +0000
commit978d5fe8a9860c3d73e4ac21011e19609438efeb (patch)
tree57d16cd86635013c5a6137606575a70463625abe /test-vasprintf.c
parent3b8a9f3d5a3fe6fb5c1f5e1bee2a81ec212fd501 (diff)
downloadmandoc-978d5fe8a9860c3d73e4ac21011e19609438efeb.tar.gz
mandoc-978d5fe8a9860c3d73e4ac21011e19609438efeb.tar.zst
mandoc-978d5fe8a9860c3d73e4ac21011e19609438efeb.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 'test-vasprintf.c')
0 files changed, 0 insertions, 0 deletions