Apply clang-format across the whole tree
Run clang-format (the repo's .clang-format: LLVM base, 120 cols, tabs, Allman functions) over every source file so the tree is formatter-clean. Whitespace only -- no behavior change; full x64 + x86 suites pass. Also set SortIncludes: false in .clang-format. Windows include order is load-bearing (windows.h must precede tlhelp32.h / mmreg.h / xinput.h / dinput.h; winsock2.h must precede windows.h), and the default alphabetical sort reorders tlhelp32.h ahead of windows.h -- a build break. Leaving order alone keeps the manual, correct grouping.
This commit is contained in:
@@ -8,13 +8,11 @@
|
||||
#include "ui/app_chrome.hpp"
|
||||
#include "ui/text_match.hpp"
|
||||
|
||||
namespace coop
|
||||
{
|
||||
namespace coop {
|
||||
|
||||
void LogPanel::add_line(const LogRecord& rec)
|
||||
{
|
||||
if (first_millis_ == 0)
|
||||
{
|
||||
if (first_millis_ == 0) {
|
||||
first_millis_ = rec.millis;
|
||||
}
|
||||
const double secs = static_cast<double>(rec.millis - first_millis_) / 1000.0;
|
||||
@@ -22,8 +20,7 @@ void LogPanel::add_line(const LogRecord& rec)
|
||||
char buf[256];
|
||||
std::snprintf(buf, sizeof(buf), "[%8.3f] %s", secs, rec.text);
|
||||
lines_.push_back({buf, rec.level});
|
||||
while (lines_.size() > kMaxLines)
|
||||
{
|
||||
while (lines_.size() > kMaxLines) {
|
||||
lines_.pop_front();
|
||||
}
|
||||
}
|
||||
@@ -38,8 +35,7 @@ void LogPanel::draw()
|
||||
apply_panel_layout(Panel::Log);
|
||||
ImGui::Begin("Log");
|
||||
|
||||
if (ImGui::Button("Clear"))
|
||||
{
|
||||
if (ImGui::Button("Clear")) {
|
||||
lines_.clear();
|
||||
first_millis_ = 0;
|
||||
}
|
||||
@@ -50,17 +46,13 @@ void LogPanel::draw()
|
||||
ImGui::InputTextWithHint("##logfilter", "filter...", filter_, sizeof(filter_));
|
||||
|
||||
ImGui::Separator();
|
||||
if (ImGui::BeginChild("loglines", ImVec2(0, 0), ImGuiChildFlags_None, ImGuiWindowFlags_HorizontalScrollbar))
|
||||
{
|
||||
if (ImGui::BeginChild("loglines", ImVec2(0, 0), ImGuiChildFlags_None, ImGuiWindowFlags_HorizontalScrollbar)) {
|
||||
const bool has_filter = filter_[0] != '\0';
|
||||
for (const Line& line : lines_)
|
||||
{
|
||||
if (has_filter && !contains_ci(line.text, filter_))
|
||||
{
|
||||
for (const Line& line : lines_) {
|
||||
if (has_filter && !contains_ci(line.text, filter_)) {
|
||||
continue;
|
||||
}
|
||||
switch (line.level)
|
||||
{
|
||||
switch (line.level) {
|
||||
case LogLevel_Warn:
|
||||
ImGui::TextColored(ImVec4(1.0f, 0.8f, 0.3f, 1.0f), "%s", line.text.c_str()); // amber
|
||||
break;
|
||||
@@ -73,8 +65,7 @@ void LogPanel::draw()
|
||||
}
|
||||
}
|
||||
// Stick to the bottom while new lines arrive (unless the user scrolled up).
|
||||
if (autoscroll_ && ImGui::GetScrollY() >= ImGui::GetScrollMaxY() - 1.0f)
|
||||
{
|
||||
if (autoscroll_ && ImGui::GetScrollY() >= ImGui::GetScrollMaxY() - 1.0f) {
|
||||
ImGui::SetScrollHereY(1.0f);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user