Skip to content

Conversation

@deathaxe
Copy link
Contributor

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.

@deathaxe deathaxe force-pushed the feat/kitty-keyboard-protocol branch 2 times, most recently from c1c8fdd to 4641331 Compare April 18, 2025 17:57
@superbobry
Copy link
Collaborator

Thanks @deathaxe. The CI configuration was not up to date. Would you mind rebasing on master?

@deathaxe deathaxe force-pushed the feat/kitty-keyboard-protocol branch from 7739b64 to a5d983d Compare April 22, 2025 16:15
@deathaxe
Copy link
Contributor Author

FWIW, KeyboardFlags could be out-sourced to a keyboards.py or something alike, if it feels too misplaced in screens.py.

@superbobry
Copy link
Collaborator

Note that mypy is unhappy on the CI.

FWIW, KeyboardFlags could be out-sourced to a keyboards.py or something alike, if it feels too misplaced in screens.py.

Yeah, this sgtm.

@deathaxe
Copy link
Contributor Author

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.

@superbobry
Copy link
Collaborator

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support for alternative keyboard protocol

2 participants