From db851737e082f6669831ab0aa63d1dbdedfe73bf Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Fri, 21 Aug 2026 19:36:54 +0200 Subject: [PATCH] Prevent ini settings from reversing sortable table column order. The imgui 1.92.9b ini writer omits 'Column N' lines for columns without saved data (e.g. the unsized, unsorted 'Zone' column of the child zones table, which only persists the default Time sort). On restore, the missing entry keeps Index == -1, the sequential fallback in TableLoadSettingsForColumns() assigns it to the remaining column, and TableFixDisplayOrder() sorts DisplayOrder -1 to the end - flipping the column order (Time | Zone in the zone info child list) for the session. Guard the non-reorderable load path against phantom entries. Upstream: https://github.com/ocornut/imgui/issues/9519 --- cmake/imgui-phantom-column.patch | 14 ++++++++++++++ cmake/vendor.cmake | 1 + 2 files changed, 15 insertions(+) create mode 100644 cmake/imgui-phantom-column.patch diff --git a/cmake/imgui-phantom-column.patch b/cmake/imgui-phantom-column.patch new file mode 100644 index 00000000..cbaf93a1 --- /dev/null +++ b/cmake/imgui-phantom-column.patch @@ -0,0 +1,14 @@ +diff --git a/imgui_tables.cpp b/imgui_tables.cpp +--- a/imgui_tables.cpp ++++ b/imgui_tables.cpp +@@ -4082,7 +4082,9 @@ + } + if (load_flags & ImGuiTableFlags_Reorderable) + column->DisplayOrder = column_settings->DisplayOrder; +- else ++ else if (column_settings->Index != -1) ++ // An Index of -1 means this column had no "Column N" line in the .ini file (columns without saved ++ // data are not written). Keep the display order as initialized (identity for non-reorderable tables). (#9519) + column->DisplayOrder = column_settings->Index; // Because default depends on previous Index, we need to set that up and cannot rely on TableInitColumnDefaults() + if ((load_flags & ImGuiTableFlags_Hideable) && column_settings->IsEnabled != -1) + column->IsUserEnabled = column->IsUserEnabledNextFrame = (column_settings->IsEnabled == 1); diff --git a/cmake/vendor.cmake b/cmake/vendor.cmake index 78003027..02d335bb 100644 --- a/cmake/vendor.cmake +++ b/cmake/vendor.cmake @@ -181,6 +181,7 @@ if(VENDOR_GUI) "${CMAKE_CURRENT_LIST_DIR}/imgui-no-samplers.patch" "${CMAKE_CURRENT_LIST_DIR}/imgui-no-default-font.patch" "${CMAKE_CURRENT_LIST_DIR}/imgui-macos-clipboard.patch" + "${CMAKE_CURRENT_LIST_DIR}/imgui-phantom-column.patch" ) set(IMGUI_SOURCES