From ad2927888b758b5b0f1a7ece8a768bcdff68092f Mon Sep 17 00:00:00 2001 From: omar Date: Tue, 8 May 2018 20:07:25 +0200 Subject: [PATCH] Apply fix from data_types branch, some widgets broken when format string doesn't contains a %. Broken by 92f0165f8540b7294db864877c614bc728ff51d7. Data_types branch fix c5fb92955524204d4aff7c9fe850645b8a37fa2a. --- imgui.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/imgui.cpp b/imgui.cpp index 092054af6..7d0e784fa 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -8681,6 +8681,9 @@ static float GetMinimumStepAtDecimalPrecision(int decimal_precision) float ImGui::RoundScalarWithFormat(const char* format, float value) { + const char* fmt_start = ParseFormatTrimDecorationsLeading(format); + if (fmt_start[0] != '%' || fmt_start[1] == '%') // Don't apply if the value is not visible in the format string + return value; char buf[64]; ImFormatString(buf, IM_ARRAYSIZE(buf), ParseFormatTrimDecorationsLeading(format), value); return (float)atof(buf);