From f072b97eb2be61c957e1b35c973740c7b394f984 Mon Sep 17 00:00:00 2001 From: Francois Chabot Date: Fri, 5 Jun 2020 16:30:21 -0400 Subject: [PATCH] use the current fill char when piping to a stream --- include/nlohmann/json.hpp | 4 ++-- single_include/nlohmann/json.hpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/nlohmann/json.hpp b/include/nlohmann/json.hpp index 43cb0003d..95ac1e9e7 100644 --- a/include/nlohmann/json.hpp +++ b/include/nlohmann/json.hpp @@ -6523,12 +6523,12 @@ class basic_json { // read width member and use it as indentation parameter if nonzero const bool pretty_print = o.width() > 0; - const auto indentation = pretty_print ? o.width() : 0; + const auto indentation = pretty_print ? o.width() : -1; // reset width to 0 for subsequent calls to this stream o.width(0); - j.dump_to(o, indentation, ' ', false); + j.dump_to(o, indentation, o.fill(), false); return o; } diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index bc63f9dc8..29b778634 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -22313,12 +22313,12 @@ class basic_json { // read width member and use it as indentation parameter if nonzero const bool pretty_print = o.width() > 0; - const auto indentation = pretty_print ? o.width() : 0; + const auto indentation = pretty_print ? o.width() : -1; // reset width to 0 for subsequent calls to this stream o.width(0); - j.dump_to(o, indentation, ' ', false); + j.dump_to(o, indentation, o.fill(), false); return o; }