Skip to content

Commit cbe36d6

Browse files
committed
DPL GUI: remove protection for spurious formatting
DebugGUI is now able to detect "%s" and shortcuts the formatting in that case. This allows us to print colored text without risks.
1 parent fb3ebd8 commit cbe36d6

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

Framework/GUISupport/src/FrameworkGUIDebugger.cxx

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -145,18 +145,12 @@ void displayHistory(const DeviceInfo& info, DeviceControl& control)
145145
ji = (ji + 1) % historySize;
146146
continue;
147147
}
148-
// Print matching lines
148+
// Print matching lines. Notice we filter twice, once on input, to reduce the
149+
// stream, a second time at display time, to avoid showing unrelevant
150+
// messages from past.
149151
if (strstr(line.c_str(), control.logFilter) != nullptr) {
150-
auto color = colorForLogLevel(logLevel);
151-
// We filter twice, once on input, to reduce the
152-
// stream, a second time at display time, to avoid
153-
// showing unrelevant messages from past.
154152
if (logLevel >= control.logLevel) {
155-
if (line.find('%', 0) != std::string::npos) {
156-
ImGui::TextUnformatted(line.c_str(), line.c_str() + line.size());
157-
} else {
158-
ImGui::TextColored(color, line.c_str(), line.c_str() + line.size());
159-
}
153+
ImGui::TextColored(colorForLogLevel(logLevel), "%s", line.c_str());
160154
}
161155
}
162156
ji = (ji + 1) % historySize;

0 commit comments

Comments
 (0)