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.

enter image description here

However, if I call "screen", the %E stops working: enter image description here

Any idea what the cause of this is, and how it can be fixed?


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 is ut.) 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 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 the bce command. One sets the default for the bce setting in all new screens with the defbce command.

So switch it on. It's as simple as that.

Further reading

  • For anyone reading and who is unfamiliar with .screenrc setup, the exact line is "defbce on" – JoshuaD Dec 27 '15 at 20:25

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.