aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/getopt/small/wrap.h
blob: e98028688d461aacd316ef22a59d353ab35fde03 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#pragma once

#include <util/generic/fwd.h>
#include <util/generic/strbuf.h>

namespace NLastGetopt {
    /**
     * Split text to multiple lines so that each line fits the given width.
     * Can work with UTF8, understands ANSI escape codes.
     *
     * @param indent will print this string after each newline.
     * @param lastLineLen output: will set to number of unicode codepoints in the last printed line.
     * @param hasParagraphs output: will set to true if there are two consecutive newlines in the text.
     */
    TString Wrap(ui32 width, TStringBuf text, TStringBuf indent = "", size_t* lastLineLen = nullptr, bool* hasParagraphs = nullptr);
}