Report the window width and height for TIOCSWINSZ

Matches behavior of xterm
This commit is contained in:
Kovid Goyal 2017-01-23 18:41:41 +05:30
parent 9cfa3dd0ea
commit d8545e5c43
2 changed files with 4 additions and 3 deletions

View File

@ -75,9 +75,9 @@ class Child:
t.start()
return pid
def resize_pty(self, w, h):
def resize_pty(self, w, h, ww, wh):
if self.child_fd is not None:
fcntl.ioctl(self.child_fd, termios.TIOCSWINSZ, struct.pack('4H', h, w, 0, 0))
fcntl.ioctl(self.child_fd, termios.TIOCSWINSZ, struct.pack('4H', h, w, ww, wh))
def hangup(self):
if self.pid is not None:

View File

@ -65,7 +65,8 @@ class Window:
def set_geometry(self, new_geometry):
if self.needs_layout or new_geometry.xnum != self.screen.columns or new_geometry.ynum != self.screen.lines:
self.screen.resize(new_geometry.ynum, new_geometry.xnum)
self.child.resize_pty(self.screen.columns, self.screen.lines)
self.child.resize_pty(self.screen.columns, self.screen.lines,
max(0, new_geometry.right - new_geometry.left), max(0, new_geometry.bottom - new_geometry.top))
self.char_grid.resize(new_geometry)
self.needs_layout = False
else: