Cygwin / mintty window size and GNU bash readline do not get along?

I have a problem with the Cygwin / mintty window size and the standard GNU bash readline shell. When I have 80 columns or less it works normally. But when I make the window wider then the bash (readline based) command line editing is all screwed up. Like it suddenly shows the cursor on white line above the text and it breaks the text at 80 characters still and is all garbled. And that is so strange because less for example and emacs also know exactly what's happening when I resize the window, they immediately resize also and work just fine.

I am sure that problem with the bash readline is fixable, but I have no clue how.


Solution 1:

This causes bash to check the terminal size after every command and adjusts $LINES and $COLUMNS to the correct values.

shopt -s checkwinsize

You can add it to your own .bashrc