From c8ff1bc9604894e41f8ede0277750aa55c203125 Mon Sep 17 00:00:00 2001 From: arch1t3cht Date: Tue, 8 Nov 2022 00:49:42 +0100 Subject: [PATCH] Clear column width cache after updating grid style Fixes arch1t3cht/Aegisub#11 --- src/base_grid.cpp | 3 +++ src/grid_column.h | 1 + 2 files changed, 4 insertions(+) diff --git a/src/base_grid.cpp b/src/base_grid.cpp index 151b15be0..861b48cc5 100644 --- a/src/base_grid.cpp +++ b/src/base_grid.cpp @@ -186,6 +186,9 @@ void BaseGrid::UpdateStyle() { row_colors.SelectedComment.SetColour(to_wx(OPT_GET("Colour/Subtitle Grid/Background/Selected Comment")->GetColor())); row_colors.LeftCol.SetColour(to_wx(OPT_GET("Colour/Subtitle Grid/Left Column")->GetColor())); + if (width_helper) + width_helper->ClearCache(); + SetColumnWidths(); AdjustScrollbar(); diff --git a/src/grid_column.h b/src/grid_column.h index 16b70f2a9..fc215d0ba 100644 --- a/src/grid_column.h +++ b/src/grid_column.h @@ -41,6 +41,7 @@ class WidthHelper { public: void SetDC(wxDC *dc) { this->dc = dc; } void Age(); + void ClearCache() { widths.clear(); }; int operator()(boost::flyweight const& str); int operator()(std::string const& str);