Ranger: After resizing ranger to 1 line height, status and command line never again find correct position

Created on 29 Jul 2019  路  5Comments  路  Source: ranger/ranger

After having resized ranger to a height of a single line (which regularly happens due to my use of tmux with heavy pane shuffling), the status bar and command line never go back to their position at the bottom causing drawing glitches (as they are drawn at position 0,0 just as the title bar)..
I tried to trace it with winpdb and .. got that to crash, tOo 馃槄
Seems within gui/displayable.py:resize(), self.win.mvderwin(y, x) fails every time after having resized so small, and self.win.getparyx() always returns 0,0 ...

bug

Most helpful comment

cool
fixed it

 diff --git ranger/gui/displayable.py ranger/gui/displayable.py
 index 16cb275f..1c3fb3e4 100644
 --- ranger/gui/displayable.py
 +++ ranger/gui/displayable.py
 @@ -197,7 +197,11 @@ class Displayable(  # pylint: disable=too-many-instance-attributes
              try:
                  self.win.mvderwin(y, x)
              except curses.error:
 -                pass
 +                try:
 +                    self.win.resize(hei, wid)
 +                    self.win.mvderwin(y, x)
 +                except curses.error:
 +                    pass

              self.paryx = self.win.getparyx()
              self.y, self.x = self.paryx

All 5 comments

I assume redraw doesn't fix it? c-l or :redraw_window?

yeah neither :reset nor :redraw_window help..

Hmm, haven't been able to reproduce yet. My terminals on mac os don't allow resizing to a single line! Ah, xterm using xQuartz allowed it. But I still couldn't reproduce, the problem is fixed almost instantly.

Do you use a really barebones terminal or something? st for example?

So I was able to reproduce in and without tmux, on guake (libvte) and xterm.. with TERM={screen,xterm,linux,vt100} ... and I found out that the resizing has to be purely vertical to trigger this. Probably because that will not invoke a status line resize..

cool
fixed it

 diff --git ranger/gui/displayable.py ranger/gui/displayable.py
 index 16cb275f..1c3fb3e4 100644
 --- ranger/gui/displayable.py
 +++ ranger/gui/displayable.py
 @@ -197,7 +197,11 @@ class Displayable(  # pylint: disable=too-many-instance-attributes
              try:
                  self.win.mvderwin(y, x)
              except curses.error:
 -                pass
 +                try:
 +                    self.win.resize(hei, wid)
 +                    self.win.mvderwin(y, x)
 +                except curses.error:
 +                    pass

              self.paryx = self.win.getparyx()
              self.y, self.x = self.paryx
Was this page helpful?
0 / 5 - 0 ratings

Related issues

kevinhwang91 picture kevinhwang91  路  5Comments

Chinggis6 picture Chinggis6  路  4Comments

noctuid picture noctuid  路  4Comments

vijaymarupudi picture vijaymarupudi  路  5Comments

chrissound picture chrissound  路  4Comments