From 55c3b4328b1cefc743275831eae76f6888868eb4 Mon Sep 17 00:00:00 2001 From: Stephan Hageboeck Date: Thu, 5 Feb 2026 10:16:59 +0100 Subject: [PATCH] [RDF] Restore stream precision and width when ProgressBar in use. As a followup to #14611, restore also precision and width of the streams. This was reported in: https://root-forum.cern.ch/t/rdf-progress-bar-changes-printout-precision/ --- tree/dataframe/src/RDFHelpers.cxx | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/tree/dataframe/src/RDFHelpers.cxx b/tree/dataframe/src/RDFHelpers.cxx index dc4c5d7515937..a98ccda0c7f4a 100644 --- a/tree/dataframe/src/RDFHelpers.cxx +++ b/tree/dataframe/src/RDFHelpers.cxx @@ -199,16 +199,27 @@ std::pair ProgressHelper::RecordEvtCountAndTi namespace { struct RestoreStreamState { - RestoreStreamState(std::ostream &stream) : fStream(stream), fFlags(stream.flags()), fFillChar(stream.fill()) {} + RestoreStreamState(std::ostream &stream) + : fStream(stream), + fFlags(stream.flags()), + fFillChar(stream.fill()), + fPrecision{stream.precision()}, + fWidth{stream.width()} + { + } ~RestoreStreamState() { fStream.flags(fFlags); fStream.fill(fFillChar); + fStream.precision(fPrecision); + fStream.width(fWidth); } std::ostream &fStream; std::ios_base::fmtflags fFlags; std::ostream::char_type fFillChar; + std::streamsize fPrecision; + std::streamsize fWidth; }; /// Format std::chrono::seconds as `1:30m`.