[console] Ensure that all ASCII characters are reachable in all keymaps

Signed-off-by: Michael Brown <mcb30@ipxe.org>
pull/591/head
Michael Brown 2022-02-15 11:51:37 +00:00
parent 429d4beb89
commit 510f9de0a2
1 changed files with 6 additions and 0 deletions

View File

@ -381,6 +381,12 @@ class Keymap:
if source.isprintable()
and target
and target in unreachable}
# Check that all characters are now reachable
unreachable -= set(table.values())
if unreachable:
raise ValueError("Unreachable characters: %s" % ', '.join(
KeymapKeys.ascii_name(x) for x in sorted(unreachable)
))
return KeymapKeys(dict(sorted(table.items())))
def cname(self, suffix: str) -> str: