On Arch Linux with Gnome 3.18, I have the problem of terminals behaving strangely when I resize a terminal window and enter some commands, such as ls or mpv, for example, and resize again by dragging the window border with the mouse cursor.

When I press to go back in history, and the line is long , no new line (or line break) is created, but the same line overwritten from left to right. When I hold on the keyboard, the prompt moves to top and 'eats' the terminal output above. I have tried an could see similar behaviour in gnome-terminal, lxterminal and xterm, all started from a gnome session.

Here's a screencast demonstrating this strange behaviour: https://vimeo.com/147162618

What could this be and where could I search the reason for this behaviour?


Usually this is due to a quirk in the way bash handles window-resizing events: it can capture SIGWINCH so that it knows how to update its notion of the screen width for editing command-lines.

The place to look is at the checkwinsize option:


If set, Bash checks the window size after each command and, if necessary, updates the values of LINES and COLUMNS.

The whole feature has had problems:

but generally the advice given is to set the option if it is not already set:

shopt -s checkwinsize

Further reading:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.