|
Ninja
|
#include <cstddef>#include <string>

Go to the source code of this file.
Functions | |
| void | ElideMiddleInPlace (std::string &str, size_t max_width) |
| Elide the given string str with '...' in the middle if the length exceeds max_width. More... | |
| void ElideMiddleInPlace | ( | std::string & | str, |
| size_t | max_width | ||
| ) |
Elide the given string str with '...' in the middle if the length exceeds max_width.
Note that this handles ANSI color sequences properly (non-color related sequences are ignored, but using them would wreak the cursor position or terminal state anyway).
Definition at line 185 of file elide_middle.cc.
References VisibleInputCharsIterator::HasChar(), AnsiColorSequenceIterator::HasSequence(), VisibleInputCharsIterator::InputIndex(), VisibleInputCharsIterator::IsVisible(), VisibleInputCharsIterator::NextChar(), and VisibleInputCharsIterator::VisiblePosition().
Referenced by main(), and LinePrinter::Print().