The Enum menus can have multiple columns, either because they are too long or because they have categories. Unfortunately they can become too wide to fit in their available space:
Shown here with the Languages list not fitting within the default width of the Preferences window:
Shown here with Editors menu not fitting within a torn-off window:
The following patch estimates the width of the menu, and if too wide will show it a single column.
Result here of Languages menu:
Result here of small torn off editor window:
This does constitute a bit of a refactor of this code. The existing code has a section where columns and rows are estimated but does not do a good enough job for this purpose. For example the list of Editors is estimated to be only two columns despite being four categories.
I have tried to keep it as simple and logical as possible. But this patch does incorporate the changes in https://developer.blender.org/D5135 as those changes are generally liked (nicer headings, better multicolumn wrapping) and it made sense to keep that as part of this refactor. I could, of course, remove those changes if desired.