From a16982956c5e87d9b2f238522d902df177ece98e Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Sat, 6 Apr 2019 23:47:48 +0300 Subject: Add support for manifest_serializer long lines mode --- libbutl/manifest-serializer.cxx | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'libbutl/manifest-serializer.cxx') diff --git a/libbutl/manifest-serializer.cxx b/libbutl/manifest-serializer.cxx index 2098551..059c374 100644 --- a/libbutl/manifest-serializer.cxx +++ b/libbutl/manifest-serializer.cxx @@ -182,7 +182,6 @@ namespace butl { char pc (c); c = *s; - bool br (false); // Break the line. // Note that even the "hard" break (see below) is not that hard when it // comes to breaking the line right after the backslash. Doing so would @@ -190,8 +189,10 @@ namespace butl // backslash would be escaped. So we delay breaking till the next // non-backslash character. // - if (pc != '\\') + if (pc != '\\' && !long_lines_) { + bool br (false); // Break the line. + // If this is a whitespace, see if it's a good place to break the // line. // @@ -238,7 +239,7 @@ namespace butl os_ << c; } - // What comes next is always a newline. I the last character that + // What comes next is always a newline. If the last character that // we have written is a backslash, escape it. // if (c == '\\') @@ -261,6 +262,11 @@ namespace butl // - value contains newlines // - value contains leading/trailing whitespaces // + // Should we use the multi-line mode for large column offsets if the long + // lines flag is set? Probably yes, as this improves the manifest + // readability, still allowing the user to easily copy the value which + // seems to be the main reason for using the flag. + // if (cl > 39 || nl () != string::npos || v.front () == ' ' || v.front () == '\t' || v.back () == ' ' || v.back () == '\t') -- cgit v1.1