src/xci/core/ArgParser.cpp
/// Check if word `s` fits in the line, possibly wrap to next line and then print the word
/// \param s            The word to be printed.
/// \param indent       Indent to output after newline (when wrapping).
/// \param start        Column after indent where to print. Actual terminal column is indent + start.
/// \param max_width    Total width, including indent, that the content should fit into. 0 = unlimited
/// \return             New start position for next call.
Check if word `s` fits in the line, possibly wrap to next line and then print the word
\param s            The word to be printed.
\param indent       Indent to output after newline (when wrapping).
\param start        Column after indent where to print. Actual terminal column is indent + start.
\param max_width    Total width, including indent, that the content should fit into. 0 = unlimited
\return             New start position for next call.
Check if word ` s ` fits in the line possibly wrap to next line and then print the word \ param s The word to be printed . \ param indent Indent to output after newline ( when wrapping ) . \ param start Column after indent where to print . Actual terminal column is indent + start . \ param max_width Total width including indent that the content should fit into . 0 = unlimited \ return New start position for next call .
static unsigned wrapping_print_word(const std::string& s, unsigned indent, unsigned start, unsigned max_width)
{
    if (max_width == 0)
        max_width = ~0u;
    assert(indent < max_width);
    auto l = TermCtl::stripped_width(s);
    if (start > 0 && start + l + 1 > max_width - indent) {
        cout << '\n' << std::string(indent, ' ');
        start = 0;
    }
    if (start != 0) {
        cout << ' ';
        ++start;
    }
    cout << s;
    return start + l;
}
static unsigned wrapping_print_word ( const std :: string & s , unsigned indent , unsigned start , unsigned max_width ) { if ( max_width == 0 ) max_width = ~ 0u ; assert ( indent < max_width ) ; auto l = TermCtl :: stripped_width ( s ) ; if ( start > 0 && start + l + 1 > max_width - indent ) { cout << ' \n ' << std :: string ( indent , ' ' ) ; start = 0 ; } if ( start != 0 ) { cout << ' ' ; ++ start ; } cout << s ; return start + l ; }
Check if word `s` fits in the line, possibly wrap to next line and then print the word
\param s            The word to be printed.
Check if word ` s ` fits in the line possibly wrap to next line and then print the word \ param s The word to be printed .
// wrap