aboutsummaryrefslogtreecommitdiff
path: root/libbutl/manifest-serializer.cxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2019-04-06 23:47:48 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2019-04-08 16:51:41 +0300
commita16982956c5e87d9b2f238522d902df177ece98e (patch)
tree71f049508596a2004b872d8b5fbdeaf473148696 /libbutl/manifest-serializer.cxx
parent89659b66de7611e9a3f33e7354493ac1c540fe70 (diff)
Add support for manifest_serializer long lines mode
Diffstat (limited to 'libbutl/manifest-serializer.cxx')
-rw-r--r--libbutl/manifest-serializer.cxx12
1 files changed, 9 insertions, 3 deletions
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')