In ZSH prompt expansion, the command %E is supposed to "Clear to end of line."
This works. We see it in the grey bar going all the way across.
However, if I call "screen", the %E stops working:
Any idea what the cause of this is, and how it can be fixed?
Best Answer
When you send one of the ECMA-48 erase control sequences, whether the erasure uses the current background colour or the default background colour varies amongst different terminal types. (In the terminfo database, there is a capability that allows programs to determine what the terminal that they are talking to will do. It is named
bce
. The termcap equivalent name isut
.) You are setting the current background colour, and then erasing to the end of the line, expecting the erasure to always use that current colour.screen
is a terminal emulator itself. But unlike most hardware terminals its behaviour in this regard is switchable. By default, background colour erase is switched off, and the control sequence causes erasure with the default colour. One switches it on with thebce
command. One sets the default for thebce
setting in all new screens with thedefbce
command.(I say most, because late model DEC VTs provide DEC Private Mode 117 for switching the behaviour. The default for these terminals was the "new" PC-compatible behaviour of erasing with the current colour, and switching Private Mode 117 off would revert back to the "old" VT-compatible behaviour of erasing with the default colour. DEC VT 52x terminals were switchable like
screen
, except that the host could do the switching and the default was the "new" behaviour, the opposite ofscreen
's default. These terminals were actually newer thanscreen
, by several years.)So switch it on. It's as simple as that.
Further reading