Update evmenu.py

This commit is contained in:
InspectorCaracal 2024-01-05 15:14:31 -07:00 committed by GitHub
parent 7a7416b084
commit 0afe81873c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1206,7 +1206,16 @@ class EvMenu:
else:
# add a default white color to key
table.append(f" |lc{raw_key}|lt|w{key}|n|le{desc_string}")
ncols = _MAX_TEXT_WIDTH // table_width_max # number of columns
# check if the caller is using a screenreader
screenreader_mode = False
if session := getattr(self.caller, 'session', None):
screenreader_mode = session.protocol_flags.get("SCREENREADER")
# the caller doesn't have a session; check it directly
elif hasattr(self.caller, 'protocol_flags'):
screenreader_mode = self.caller.protocol_flags.get("SCREENREADER")
ncols = 1 if screenreader_mode else _MAX_TEXT_WIDTH // table_width_max
if ncols < 0:
# no visible options at all