Clear to end of line uses the wrong background color in tmux

In ZSH prompt expansion, the command %E is supposed to “Clear to end of line.”

This works:
enter image description here

However, it does not work in tmux:
enter image description here

The issue seems to be with BCE (Background Color Erase). In screen, I can add the option defbce on. I can’t find any similar setting for tmux. Does it exist?

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

Unlike screen, tmux does not have switchable background colour erase capability in its terminal emulator. Erasure is always with the default background colour, never the current background colour.

Nicholas Marriott added it to the to-do list in September 2015, but stated at the time that neither he nor anyone else cares enough about it to implement it.

He later implemented it in October 2016, nearly a year after this answer was originally written.

Further reading

t_ut turns off BCE. tmux should support BCE but it depends on the tmux version, I think 2.1 is too old.


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x