mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-06 03:08:55 -05:00
[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.
This commit is contained in:
parent
dc8e61cbe5
commit
7c404082f8
@ -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)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user