|
|
|
|
|
by keithwinstein
5165 days ago
|
|
zsh's approach is clever and doesn't require bidirectional communication. They always print their inverted "%" and then they print as many spaces as you have columns in the terminal (minus one). If the last process ended with a CRLF, they will now be in the last column of the same line; otherwise they will have wrapped around to a new line (assuming the terminal is in auto wrap mode, which is the default). Then they print a carriage return and the prompt as normal. This does break if the terminal has auto wrap turned off (echo -e "\033[?7l"), but otherwise it's very clever. |
|