News for hackers. Stuff that matters.
Re:Your Bash Prompt Needs This by air-lemming on Friday April 27, 2012 @12:42PM (#3899878)
My prompt puts a newline if the cursor is not in the first column, but getting the cursor position complicates things.

https://github.com/dylanahsmith/dotfiles/blob/master/.config...

Re:Your Bash Prompt Needs This by keithwinstein on Friday April 27, 2012 @07:26PM (#3901485)
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.

Re:Your Bash Prompt Needs This by air-lemming on Sunday April 29, 2012 @03:25AM (#3905394)
That solution sounds even more hacky. Just like I expected resizing my iterm2 window causes glitches because it's text reflowing. I love that feature, but I realize this isn't a problem for all terminals.
Re:Your Bash Prompt Needs This by adavies42 on Friday April 27, 2012 @02:21PM (#3900384)
looks interesting, but it doesn't seem to be compatible with either my setup in general (bash 3.2.25 inside screen inside PuTTY) or my current prompt, which comes out of a shell function and embeds the number of files in pwd, username@hostname:pwd, and previous status, with coloring applied to various parts.

specifically your function just sort of sits there doing nothing when i try it....