MCPcopy Create free account
hub / github.com/emscripten-core/emscripten / printWrap

Function printWrap

system/lib/wasmfs/fuzzer/support/command-line.cpp:23–48  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

21#endif
22
23void printWrap(std::ostream& os, int leftPad, const std::string& content) {
24 int len = content.size();
25 int space = SCREEN_WIDTH - leftPad;
26 std::string nextWord;
27 std::string pad(leftPad, ' ');
28 for (int i = 0; i <= len; ++i) {
29 if (i != len && content[i] != ' ' && content[i] != '\n') {
30 nextWord += content[i];
31 } else {
32 if (static_cast<int>(nextWord.size()) > space) {
33 os << '\n' << pad;
34 space = SCREEN_WIDTH - leftPad;
35 }
36 os << nextWord;
37 space -= nextWord.size() + 1;
38 if (space > 0) {
39 os << ' ';
40 }
41 nextWord.clear();
42 if (content[i] == '\n') {
43 os << '\n';
44 space = SCREEN_WIDTH - leftPad;
45 }
46 }
47 }
48}
49
50Options::Options(const std::string& command, const std::string& description)
51 : debug(false), positional(Arguments::Zero) {

Callers 1

OptionsMethod · 0.85

Calls 2

sizeMethod · 0.65
clearMethod · 0.45

Tested by

no test coverage detected