Skip to content

Vterm now emits 'resize' signal upon terminal resize #584

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 15, 2023
Merged

Vterm now emits 'resize' signal upon terminal resize #584

merged 1 commit into from
Aug 15, 2023

Conversation

danschwarz
Copy link
Contributor

Checklist
  • I've ensured that similar functionality has not already been implemented
  • I've ensured that similar functionality has not earlier been proposed and declined
  • I've branched off the master or python-dual-support branch
  • I've merged fresh upstream into my branch recently
  • I've ran tox successfully in local environment
  • I've included docstrings and/or documentation and/or examples for my code (if this is a new feature)
Description:

Vterm now emits 'resize' signal upon terminal resize, with a (height, width) tuple of the new size.

examples/terminal.py has been updated to handle the 'resize' signal, and uses it to display the terminal height x width. This is useful for testing purposes if you want to test vterm at a particular size.

@danschwarz
Copy link
Contributor Author

danschwarz commented Jul 13, 2023

Code seem to work well. I attempted to add the following test to tests/test_vterm.py, but I have not been successful in getting it to work properly (test always fails to receive the signal)
Any suggestions on how to make this test work properly are appreciated.

    def test_resize_signal(self):
        self.connect_signal('resize')
        self.resize(80, 24)
        self.expect_signal('resize')
        self.disconnect_signal('resize')

image

examples/terminal.py has been updated to handle the
'resize' signal, and uses it to display the terminal
height x width.  This is useful for testing purposes
if you want to test vterm at a particular size.
Copy link
Collaborator

@penguinolog penguinolog left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll try to investigate tests ASAP

@danschwarz
Copy link
Contributor Author

Thanks. Good to see you back! Hoping for a new Urwid release in the near future?

@penguinolog
Copy link
Collaborator

Looks like need to release "binary only 3.7 ≤ python ≤ 3.11and later fix python 3.12+ unicode compatibility (new API was in python 3 almost forever, old was because of python 2)

@penguinolog
Copy link
Collaborator

Issue for tests write was created (for resize test is a bit not trivial)

@penguinolog penguinolog merged commit 7e9f5b1 into urwid:master Aug 15, 2023
@danschwarz danschwarz deleted the vterm_resize branch December 7, 2023 15:09
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.

2 participants