This commit is contained in:
Firepup Sixfifty 2024-06-03 15:27:53 -05:00
parent ec7ad5845c
commit 8534a3c865
Signed by: Firepup650
GPG key ID: 7C92E2ABBBFAB9BA
3 changed files with 11 additions and 7 deletions

View file

@ -1,6 +1,8 @@
# Firepup650
Package containing various shorthand things I use, and a few imports I almost always use
### Change log:
#### v.1.0.39:
Add offset mappings for exceeding 1 Million options, new limit is 10 Million options
#### v.1.0.38:
Mappings for much larger menu sizes, hopefully no one should ever hit that limit.
#### v.1.0.37:

View file

@ -1,6 +1,6 @@
[tool.poetry]
name = "firepup650"
version = "1.0.38"
version = "1.0.39"
authors = ["Firepup650 <firepyp650@gmail.com>"]
description = "Package containing various shorthand things I use, and a few imports I almost always use"
readme = "README.md"

View file

@ -882,18 +882,20 @@ def menu(options: dict, title: str = "") -> object:
indicatorSize = len(str(limit)) * 2 + 1
indicatorOffset = 999
match indicatorSize:
case 3: # 1-9 options
case 3: # 1-9 options (Ten rolls over)
indicatorOffset = 1
case 5: # 10-99 options
case 5: # 10-99 options (One Hundered rolls over)
indicatorOffset = 0
case 7: # 100-999 options
case 7: # 100-999 options (One Thousand rolls over)
indicatorOffset = -1
case 9: # 1000-9999 options
case 9: # 1000-9999 options (Ten Thousand rolls over)
indicatorOffset = -2
case 11: # 10000-99999 options
case 11: # 10000-99999 options (One Hundred Thousand rolls over)
indicatorOffset = -3
case 13: # 100000-999999 options
case 13: # 100000-999999 options (One Million rolls over)
indicatorOffset = -4
case 15: # 1000000-9999999 options (Ten Million rolls over)
indicatorOffset = -5
case _:
raise ValueError(
f"You have more menu options than was ever expected to be used, please notify the package author to add a offset mappting for an indicator size of {indicatorSize}."