@@ -1069,6 +1069,8 @@ function updateDebugGridList(searchText)
10691069
10701070 guiGridListClear (debugGrid )
10711071
1072+ local longestTextLength = 0 -- Track the longest text length
1073+
10721074 for _ , msg in ipairs (debugMessages ) do
10731075 local debugLevel = DEBUG_LEVELS [msg .level ].level
10741076
@@ -1078,13 +1080,21 @@ function updateDebugGridList(searchText)
10781080 guiGridListSetItemText (debugGrid , row , 1 , msg .time , false , false )
10791081 guiGridListSetItemText (debugGrid , row , 2 , msg .level , false , false )
10801082 guiGridListSetItemText (debugGrid , row , 3 , msg .displayMessage , false , false )
1083+
1084+ longestTextLength = math.max (longestTextLength , # msg .displayMessage )
1085+
10811086 local r , g , b = hexToRGB (msg .color )
10821087 for col = 1 , 3 do
10831088 guiGridListSetItemColor (debugGrid , row , col , r * 255 , g * 255 , b * 255 , 255 )
10841089 end
10851090 end
10861091 end
10871092
1093+ -- Dynamically adjust the third column width based on the longest text
1094+ local charWidth = 8 -- Approximate width of a character in pixels
1095+ local minWidth = 200 -- Minimum width for the message column
1096+ local newWidth = math.max (minWidth , math.min (longestTextLength * charWidth , panelWidth - 50 ))
1097+ guiGridListSetColumnWidth (debugGrid , 3 , newWidth , false )
10881098
10891099 setTimer (function ()
10901100 guiGridListSetVerticalScrollPosition (debugGrid , 100 )
0 commit comments