pudb icon indicating copy to clipboard operation
pudb copied to clipboard

PuDB does not update for terminal size changes [Urwid issue]

Open pyrrhull opened this issue 3 years ago • 6 comments

When I resize the terminal (gnome-terminal) the view stays the same size although the window becomes bigger. After I move the cursor it becomes fullsize. It is weird as this only happens with pudb, not with other terminal programs ( I use ubuntu and i3 wm). pudb

Originally posted by @makrobios in https://github.com/inducer/pudb/issues/410#issuecomment-758295335

pyrrhull avatar Jan 12 '21 00:01 pyrrhull

Took a look. As best as I can tell, this is actually an Urwid issue.

Applying this patch to https://github.com/urwid/urwid/commit/4c739b6be21b0c98324e7b7780d8e712f3ad6db3 fixes the issue for the raw display:

diff --git a/urwid/raw_display.py b/urwid/raw_display.py
index 4c90a68..80156f2 100644
--- a/urwid/raw_display.py
+++ b/urwid/raw_display.py
@@ -538,7 +538,7 @@ class Screen(BaseScreen, RealTerminal):
 
     def _wait_for_input_ready(self, timeout):
         ready = None
-        fd_list = []
+        fd_list = [self._resize_pipe_rd]
         fd = self._input_fileno()
         if fd is not None:
             fd_list.append(fd)

inducer avatar Jan 14 '21 05:01 inducer

Great, thanks a lot! I applied your patch to urwid 2.1.2 and it works too. Just out of curiosity, how did you debug this issue?

pyrrhull avatar Jan 14 '21 11:01 pyrrhull

What I did was start reading at the SIGWINCH handler in Urwid and figure out how the data makes its way to the main loop from there.

inducer avatar Jan 14 '21 14:01 inducer

Filed a PR in Urwid with this change: https://github.com/urwid/urwid/pull/453. Let's see what they say.

inducer avatar Jan 14 '21 14:01 inducer

I have to add that in case of my closed issue https://github.com/inducer/pudb/issues/531 the correct terminal size is not read at all. I am getting just one fixed resolution that does not reflect terminal size I run the debugging in with no way to change it.

kulvait avatar Jul 19 '22 14:07 kulvait

The patch mentioned also do not fix my issue.

kulvait avatar Jul 19 '22 14:07 kulvait