bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Bash Missing Terminal Resize Events


From: Evan Klitzke
Subject: Bash Missing Terminal Resize Events
Date: Sat, 18 Nov 2017 18:11:18 -0800

Hi,

Bash will miss terminal resize events in the following scenario:

* Open a terminal (I tested with xterm and gnome-terminal)
* Run vim
* Resize the terminal
* Background vim using Ctrl-Z

At the point SIGWINCH will have been delivered to vim, but not to bash.
Bash is in the read part of the read-eval loop, but it still thinks the
terminal has the original dimensions. This causes readline to wrap input
incorrectly. You can also see this by GDB attaching to the bash process and
examining the value of _rl_screenwidth, which will be the old screen width.
If you manually SIGWINCH bash, then readline will re-query the terminal
dimensions and input will wrap correctly. Note that this problem isn't
specific to vim.

I think that bash should re-query the terminal size every time it returns
from handling a job. As I understand, the overhead is making a single
TIOCGSIZE ioctl, which is minuscule, especially considering it only has to
be done once per line of input.

-- 
evan klitzke
w: https://eklitzke.org/
e: address@hidden


reply via email to

[Prev in Thread] Current Thread [Next in Thread]