Support progressive enhencements
Resolves #194
This PR adds Screen.set_keyboard_flags() event handler, to handle progressive enhancement events.
The Screen class therefore maintains a stack of Screen.keybord_flags, which is managed by set_keybord_flags() handler, if Stream detects related CSI = flags ; mode u, CSI > flags u or CSI < count u escape sequences.
Sending proper key sequences to shell is up to a real terminal implementation, which can use Screen.keyboard_flags to query requested features.
This PR ensures not to pass through related escape sequences to buffer.
Thanks @deathaxe. The CI configuration was not up to date. Would you mind rebasing on master?
FWIW, KeyboardFlags could be out-sourced to a keyboards.py or something alike, if it feels too misplaced in screens.py.
Note that mypy is unhappy on the CI.
FWIW,
KeyboardFlagscould be out-sourced to a keyboards.py or something alike, if it feels too misplaced in screens.py.
Yeah, this sgtm.
Well, I've rarely seen general *args and *kwargs being typed anywhere as they can contain arbritary number of arguments of any type. In this special case list[int] might work as this is what arguments of CSI sequences are defined as.
An unfortunate issue with mypy is that it does not type check functions if any type hint is missing (at least not by default). I guess you could use object or Any?