Add on_resize to xterm and show how to use it in xterm example#5858
Open
jacopofar wants to merge 2 commits intozauberzeug:mainfrom
Open
Add on_resize to xterm and show how to use it in xterm example#5858jacopofar wants to merge 2 commits intozauberzeug:mainfrom
jacopofar wants to merge 2 commits intozauberzeug:mainfrom
Conversation
Collaborator
|
@jacopofar could you get pre-commit and pylint happy? Thanks 🙏🏻 |
4 tasks
Author
|
Yep, sorry about that |
72480a9 to
df847e1
Compare
Collaborator
|
Nice, @jacopofar. Two tips:
Though for 2 you made a good call since we need the KWONLY_SLOTS deprecation, otherwise we don't do it unless something in main we really need. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
This tries to implement a solution to the issue described in #5847
The idea is to make it easier to detect xterm size changes (with an handler+event with proper types) and extend the xterm example with code to handle the resize and communicate it to the process, plus a comment to explain how to test it.
Implementation
This implements the change suggested in the original discussion to expose on_resize as an handler with an event using the proper type (the resize event was already available using
terminal.on('resize', ...), now it's simply available as an handler with a typed event.The logic to send the control codes requires a pty and so it cannot be incorporated in the xterm element but it has to be in the caller.
There are two things on which I have doubts:
xtermelement itself. A possible way would be to create a separatePtyXtermelement or something like that that already starts a command and a pty and handles it internally. How does it sound?Progress