Export of internal Abseil changes
-- 00c451dc81be7fe05f982b08b4ea1edc2ca2c1c5 by Abseil Team <absl-team@google.com>: remove a test that is currently broken on emscripten from running on emscripten. PiperOrigin-RevId: 262005667 -- 9df5f5acb65996bdb99900039a4f01a44811aa14 by CJ Johnson <johnsoncj@google.com>: Adds a layer of macro-indirection to opening up namespace absl inside a macro. This helps avoid an issue identified with the LTS inline namespaces PiperOrigin-RevId: 261990937 -- 5d40aa129cd77a1b853e5389aff7eacffe5c8204 by Gennadiy Rozental <rogeeff@google.com>: Fix handling of new lines in flag help descriptions. If there are explicit new lines in a flag help description string, we respect it and format the usage message accordingly. PiperOrigin-RevId: 261974244 -- 4997b5a2ddb983969059470a2d2bc2416b3d785e by CJ Johnson <johnsoncj@google.com>: Import of CCTZ from GitHub. PiperOrigin-RevId: 261955031 GitOrigin-RevId: 00c451dc81be7fe05f982b08b4ea1edc2ca2c1c5 Change-Id: I5a13bfb15bba0f7b6e49c0655c57c3addfeb1c72
This commit is contained in:
parent
67222ffc4c
commit
b49b8d16b6
5 changed files with 57 additions and 8 deletions
|
|
@ -111,8 +111,16 @@ class FlagHelpPrettyPrinter {
|
|||
|
||||
std::vector<absl::string_view> tokens;
|
||||
if (wrap_line) {
|
||||
tokens = absl::StrSplit(str, absl::ByAnyChar(" \f\n\r\t\v"),
|
||||
absl::SkipEmpty());
|
||||
for (auto line : absl::StrSplit(str, absl::ByAnyChar("\n\r"))) {
|
||||
if (!tokens.empty()) {
|
||||
// Keep line separators in the input std::string.
|
||||
tokens.push_back("\n");
|
||||
}
|
||||
for (auto token :
|
||||
absl::StrSplit(line, absl::ByAnyChar(" \t"), absl::SkipEmpty())) {
|
||||
tokens.push_back(token);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
tokens.push_back(str);
|
||||
}
|
||||
|
|
@ -120,6 +128,12 @@ class FlagHelpPrettyPrinter {
|
|||
for (auto token : tokens) {
|
||||
bool new_line = (line_len_ == 0);
|
||||
|
||||
// Respect line separators in the input std::string.
|
||||
if (token == "\n") {
|
||||
EndLine();
|
||||
continue;
|
||||
}
|
||||
|
||||
// Write the token, ending the std::string first if necessary/possible.
|
||||
if (!new_line && (line_len_ + token.size() >= max_line_len_)) {
|
||||
EndLine();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue