Fix up/down key ansi sequences. (#2280)

* Fix up/down key ansi sequences.

Related issues: #2223.
Related comments: [my reply to OP](https://github.com/Textualize/textual/issues/2223\#issuecomment-1505512300) and [the OP's reply](https://github.com/Textualize/textual/issues/2223\#issuecomment-1506764562).

* Changelog.
This commit is contained in:
Rodrigo Girão Serrão
2023-04-23 14:14:36 +01:00
committed by GitHub
parent 3736807359
commit 50030b427f
2 changed files with 7 additions and 6 deletions

View File

@@ -55,6 +55,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
### Fixed
- Fixed order styles are applied in DataTable - allows combining of renderable styles and component classes https://github.com/Textualize/textual/pull/2272
- Fixed key combos with up/down keys in some terminals https://github.com/Textualize/textual/pull/2280
- Fix empty ListView preventing bindings from firing https://github.com/Textualize/textual/pull/2281
- Fix `get_component_styles` returning incorrect values on first call when combined with pseudoclasses https://github.com/Textualize/textual/pull/2304
- Fixed `active_message_pump.get` sometimes resulting in a `LookupError` https://github.com/Textualize/textual/issues/2301

View File

@@ -210,8 +210,8 @@ ANSI_SEQUENCES_KEYS: Mapping[str, Tuple[Keys, ...]] = {
"\x1b[1;3F": (Keys.Escape, Keys.End),
"\x1b[1;3H": (Keys.Escape, Keys.Home),
# Alt+shift+number.
"\x1b[1;4A": (Keys.Escape, Keys.ShiftDown),
"\x1b[1;4B": (Keys.Escape, Keys.ShiftUp),
"\x1b[1;4A": (Keys.Escape, Keys.ShiftUp),
"\x1b[1;4B": (Keys.Escape, Keys.ShiftDown),
"\x1b[1;4C": (Keys.Escape, Keys.ShiftRight),
"\x1b[1;4D": (Keys.Escape, Keys.ShiftLeft),
"\x1b[1;4F": (Keys.Escape, Keys.ShiftEnd),
@@ -240,15 +240,15 @@ ANSI_SEQUENCES_KEYS: Mapping[str, Tuple[Keys, ...]] = {
"\x1b[1;6F": (Keys.ControlShiftEnd,),
"\x1b[1;6H": (Keys.ControlShiftHome,),
# Control + Meta + arrows.
"\x1b[1;7A": (Keys.Escape, Keys.ControlDown),
"\x1b[1;7B": (Keys.Escape, Keys.ControlUp),
"\x1b[1;7A": (Keys.Escape, Keys.ControlUp),
"\x1b[1;7B": (Keys.Escape, Keys.ControlDown),
"\x1b[1;7C": (Keys.Escape, Keys.ControlRight),
"\x1b[1;7D": (Keys.Escape, Keys.ControlLeft),
"\x1b[1;7F": (Keys.Escape, Keys.ControlEnd),
"\x1b[1;7H": (Keys.Escape, Keys.ControlHome),
# Meta + Shift + arrows.
"\x1b[1;8A": (Keys.Escape, Keys.ControlShiftDown),
"\x1b[1;8B": (Keys.Escape, Keys.ControlShiftUp),
"\x1b[1;8A": (Keys.Escape, Keys.ControlShiftUp),
"\x1b[1;8B": (Keys.Escape, Keys.ControlShiftDown),
"\x1b[1;8C": (Keys.Escape, Keys.ControlShiftRight),
"\x1b[1;8D": (Keys.Escape, Keys.ControlShiftLeft),
"\x1b[1;8F": (Keys.Escape, Keys.ControlShiftEnd),