Skip to content

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

Merged
penguinolog merged 1 commit into
urwid:masterfrom
danschwarz:vterm_resize
Aug 15, 2023
Merged

Vterm now emits 'resize' signal upon terminal resize#584
penguinolog merged 1 commit into
urwid:masterfrom
danschwarz:vterm_resize

Conversation

@danschwarz

Copy link
Copy Markdown
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

danschwarz commented Jul 13, 2023

Copy link
Copy Markdown
Contributor Author

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.

@penguinolog penguinolog left a comment

Copy link
Copy Markdown
Collaborator

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
Copy Markdown
Contributor Author

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

@penguinolog

Copy link
Copy Markdown
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
Copy Markdown
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