wrap.h 663 B

12345678910111213141516
  1. #pragma once
  2. #include <util/generic/fwd.h>
  3. #include <util/generic/strbuf.h>
  4. namespace NLastGetopt {
  5. /**
  6. * Split text to multiple lines so that each line fits the given width.
  7. * Can work with UTF8, understands ANSI escape codes.
  8. *
  9. * @param indent will print this string after each newline.
  10. * @param lastLineLen output: will set to number of unicode codepoints in the last printed line.
  11. * @param hasParagraphs output: will set to true if there are two consecutive newlines in the text.
  12. */
  13. TString Wrap(ui32 width, TStringBuf text, TStringBuf indent = "", size_t* lastLineLen = nullptr, bool* hasParagraphs = nullptr);
  14. }