You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Recently I made a Web terminal with ptyprocess, websocket, and XTerm, but eventually found that the Web terminal size could not adapt after the resize event was triggered.
I even thought my computer was actually a big phone until I switched the positions of two parameters and the page appeared normal.
Before:
def_setwinsize(fd, rows, cols):
# Some very old platforms have a bug that causes the value for# termios.TIOCSWINSZ to be truncated. There was a hack here to work# around this, but it caused problems with newer platforms so has been# removed. For details see https://github.com/pexpect/pexpect/issues/39TIOCSWINSZ=getattr(termios, 'TIOCSWINSZ', -2146929561)
# Note, assume ws_xpixel and ws_ypixel are zero.s=struct.pack('HHHH', rows, cols, 0, 0)
fcntl.ioctl(fd, TIOCSWINSZ, s)
After using the following modified code, the interface display is normal:
def_setwinsize(fd, rows, cols):
# Some very old platforms have a bug that causes the value for# termios.TIOCSWINSZ to be truncated. There was a hack here to work# around this, but it caused problems with newer platforms so has been# removed. For details see https://github.com/pexpect/pexpect/issues/39width, height=cols, rowsTIOCSWINSZ=getattr(termios, 'TIOCSWINSZ', -2146929561)
# Note, assume ws_xpixel and ws_ypixel are zero.s=struct.pack('HHHH', width, height, 0, 0)
fcntl.ioctl(fd, TIOCSWINSZ, s)
The text was updated successfully, but these errors were encountered:
The ioctl man page says that rows (i.e. height) comes first, and then columns (width). I've also used this code to do basically the same thing you describe years ago, to have a web based terminal in the Jupyter interface (part of this is the terminado package).
So double check and see if it's possible that the parameters are being switched round somewhere before they get to ptyprocess. 🙂
Recently I made a Web terminal with ptyprocess, websocket, and XTerm, but eventually found that the Web terminal size could not adapt after the resize event was triggered.
I even thought my computer was actually a big phone until I switched the positions of two parameters and the page appeared normal.
Before:
After using the following modified code, the interface display is normal:
The text was updated successfully, but these errors were encountered: