diff --git a/docs/custom_theme/main.html b/docs/custom_theme/main.html index 810469c9f..8e2960ddd 100644 --- a/docs/custom_theme/main.html +++ b/docs/custom_theme/main.html @@ -2,4 +2,7 @@ {% block extrahead %} + + + {% endblock %} diff --git a/examples/calculator.py b/examples/calculator.py index a375e1af0..60d982f96 100644 --- a/examples/calculator.py +++ b/examples/calculator.py @@ -24,6 +24,7 @@ class CalculatorApp(App): "asterisk": "multiply", "slash": "divide", "underscore": "plus-minus", + "full_stop": "point", "plus_minus_sign": "plus-minus", "percent_sign": "percent", "equals_sign": "equals", diff --git a/src/textual/app.py b/src/textual/app.py index af26d2f44..602e001f1 100644 --- a/src/textual/app.py +++ b/src/textual/app.py @@ -612,6 +612,13 @@ class App(Generic[ReturnType], DOMNode): print(f"(pause {wait_ms}ms)") await asyncio.sleep(float(wait_ms) / 1000) else: + if len(key) == 1 and not key.isalnum(): + key = ( + unicodedata.name(key) + .lower() + .replace("-", "_") + .replace(" ", "_") + ) original_key = REPLACED_KEYS.get(key, key) try: char = unicodedata.lookup( @@ -620,7 +627,8 @@ class App(Generic[ReturnType], DOMNode): except KeyError: char = key if len(key) == 1 else None print(f"press {key!r} (char={char!r})") - driver.send_event(events.Key(self, key, char)) + key_event = events.Key(self, key, char) + driver.send_event(key_event) await asyncio.sleep(0.01) await app._animator.wait_for_idle()