From 5adfeaa1c1616b93e1b9b961fff6d60e17d5559d Mon Sep 17 00:00:00 2001 From: eidheim Date: Wed, 7 Jul 2021 13:31:17 +0200 Subject: [PATCH] Use stringstream reconstruction instead of using clear() --- src/source.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/source.cpp b/src/source.cpp index 1149350..1f5b0ba 100644 --- a/src/source.cpp +++ b/src/source.cpp @@ -867,7 +867,6 @@ void Source::View::setup_format_style(bool is_generic_view) { } stdout_buffer.write(bytes, n); if(curly_count == 0) { - key_or_value = false; try { JSON json(stdout_buffer); LockGuard lock(mutex); @@ -877,7 +876,8 @@ void Source::View::setup_format_style(bool is_generic_view) { LockGuard lock(mutex); error = Error{std::string(e.what()) + "\nOutput from prettier: " + stdout_buffer.str()}; } - stdout_buffer.clear(); + stdout_buffer = std::stringstream(); + key_or_value = false; } }, [](const char *bytes, size_t n) {