GNU screen has been a key player in my workflow for a long time, and I’ve been putting up with a strange and very much undesired screen behavior for just about that long. I don’t fully understand the problem, but at least now I have a fix.
The problem is that when in screen, some ‘full-screen’ curses based apps like vim or mutt will cause screen to render empty space as white space… like for example all the space between the end of a line and the right side of the window. Normally this is not a problem. Who cares if it’s white space at the output rendering layer, right? Well, as it turns out, the guy on the other end of the clipboard really cares, even if you are that guy. Trust me. He’s actually kinda angry that it’s taken this long for his lobbying efforts to bear fruit.
Anyway, the fix is to employ the services of background color erase, known on the street as bce.
The correct setting for me is: on, although I can’t really deduce that from the above description. Basically I just showed up in #screen on freenode, started mumbling, and somebody was like “… bce on?”, which was enough for me to arrive at the following .screenrc additions:
defbce on
term screen-bce
Here’s a short demo of expected behavior outside of screen, broken behavior in screen, and then fixed behavior.