Autodetect common escape codes in fish_prompt output

darcs-hash:20051213101859-ac50b-0ff01bb168d894d401d3d93cc11740789bac0d62.gz
This commit is contained in:
axel
2005-12-13 20:18:59 +10:00
parent 9c32709fe1
commit 8bf0a14bd5
4 changed files with 129 additions and 20 deletions

View File

@@ -915,17 +915,11 @@ The default \c fish prompt is
<p>
<pre>
function fish_prompt -d "Write out the prompt"
printf '\%s\@\%s\%s\\n\%s\%s\\n> ' (whoami) (hostname|cut -d . -f 1) (set_color \$fish_color_cwd) (prompt_pwd) (set_color normal)
printf '\%s\@\%s\%s\%s\%s> ' (whoami) (hostname|cut -d . -f 1) (set_color \$fish_color_cwd) (prompt_pwd) (set_color normal)
end
</pre>
</p>
If you are using \c set_color or other commands that output escape
codes to change the font settings of the terminal, you must always and
every such sequence with a newline. This is needed since fish needs to
know that exact length of the prompt in order to tetect when the
cursor reaches the end of the line. Any newlines in the output of the
\c fish_prompt command are ignored.
\subsection title Programmable title