From 7c404082f8351476df0223a45d5ae1bc820015ea Mon Sep 17 00:00:00 2001 From: bobloy Date: Wed, 6 Feb 2019 02:59:54 -0500 Subject: [PATCH] [Help] Group Fields respect page_char_limit (#2281) It would groups the cogs until it is **greater** than the set `page_char_limit` in helpset. This leads to inconsistent page sizes when a large cog was appended to something barely under the limit. I think this commit will reign in the weirdness by adjusting the secondary grouping to aim for **less than** `page_char_limit` grouping. --- redbot/core/help_formatter.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/redbot/core/help_formatter.py b/redbot/core/help_formatter.py index 81e42755e..4d75bfa69 100644 --- a/redbot/core/help_formatter.py +++ b/redbot/core/help_formatter.py @@ -215,10 +215,10 @@ class Help(dpy_formatter.HelpFormatter): curr_group = [] ret = [] for f in fields: - curr_group.append(f) - if sum(len(f.value) for f in curr_group) > max_chars: + if sum(len(f2.value) for f2 in curr_group) + len(f.value) > max_chars and curr_group: ret.append(curr_group) curr_group = [] + curr_group.append(f) if len(curr_group) > 0: ret.append(curr_group)