More features for TextLineWrapper.
authorTeemu Murtola <teemu.murtola@gmail.com>
Mon, 27 Aug 2012 17:53:06 +0000 (20:53 +0300)
committerTeemu Murtola <teemu.murtola@gmail.com>
Fri, 7 Sep 2012 04:11:45 +0000 (07:11 +0300)
commit3ffcfd69a4b9a0e7289e947489e69d3d35c25403
tree09ac2c598a7f5d61a9d0597cb6a2aab545bfb149
parentd0ce0f39cf509c8be5635bad445fbfcba9b0c2b3
More features for TextLineWrapper.

Add more control over formatting the wrapped lines:
- Add possibility to indent the wrapped lines.
- Add possibility to indent the first line after an explicit line break
  differently from other lines.
- Add possibility to mark line continuation using an explicit character.
- Add possibility to either remove or keep leading whitespace after an
  explicit line break.
All except the last are already useful for the current console output.
Depending on the chosen solution, some or all of these are also needed
for #969.

Also expose the lower-level interface used internally that makes it
possible to write code that iterates over the wrapped lines and does
something else than just format them into a buffer.  May be useful for
some cases in #969, but is necessary to use the wrapper for #838 (line
wrapping in error messages).

Change-Id: I905ba29856773656bf000c4b2e14d1ed2ba4de31
src/gromacs/commandline/cmdlinehelpwriter.cpp
src/gromacs/onlinehelp/helpformat.cpp
src/gromacs/onlinehelp/helptopic.h
src/gromacs/onlinehelp/helpwritercontext.cpp
src/gromacs/utility/stringutil.cpp
src/gromacs/utility/stringutil.h
src/gromacs/utility/tests/refdata/TextLineWrapperTest_HandlesContinuationCharacter.xml [new file with mode: 0644]
src/gromacs/utility/tests/refdata/TextLineWrapperTest_HandlesHangingIndent.xml [new file with mode: 0644]
src/gromacs/utility/tests/refdata/TextLineWrapperTest_HandlesIndent.xml [new file with mode: 0644]
src/gromacs/utility/tests/refdata/TextLineWrapperTest_WrapsCorrectlyWithExtraWhitespace.xml
src/gromacs/utility/tests/stringutil.cpp