summary refs log tree commit diff
path: root/Etc/FAQ.yo
diff options
context:
space:
mode:
authorWayne Davison <wayned@users.sourceforge.net>2005-07-26 18:48:28 +0000
committerWayne Davison <wayned@users.sourceforge.net>2005-07-26 18:48:28 +0000
commitd3e176012d02e994bf3b08544f5a78a8c35899f3 (patch)
tree660a00571a9c63741175abf329e2f5dd1c2998cb /Etc/FAQ.yo
parente6fdd78a182abf413d801b1bd93e75d4890c7d19 (diff)
downloadzsh-d3e176012d02e994bf3b08544f5a78a8c35899f3.tar.gz
zsh-d3e176012d02e994bf3b08544f5a78a8c35899f3.tar.xz
zsh-d3e176012d02e994bf3b08544f5a78a8c35899f3.zip
Updated the entry that talks about PROMPT_CR and PROMPT_SP to suggest
a better precmd function -- one that includes an inverse hash, and
that outputs all its input in one go so that echoed input can't trip
up the algorithm and cause a wrap when it shouldn't.
Diffstat (limited to 'Etc/FAQ.yo')
-rw-r--r--Etc/FAQ.yo11
1 files changed, 4 insertions, 7 deletions
diff --git a/Etc/FAQ.yo b/Etc/FAQ.yo
index 4ba5bee83..ae338a7f4 100644
--- a/Etc/FAQ.yo
+++ b/Etc/FAQ.yo
@@ -1664,13 +1664,10 @@ sect(How do I prevent the prompt overwriting output when there is no newline?)
     # Skip defining precmd if the PROMPT_SP option is available.
     if ! eval '[[ -o promptsp ]] 2>/dev/null'; then
       function precmd {
-        # An efficient version using termcap multi-right:
-        echo -n ' '       # Output 1 space
-        echotc RI $((COLUMNS - 3))
-        echo -n '  '      # Output 2 spaces
-        # Alternately, try replacing the above 3 lines with this echo
-        # that outputs a screen-column-width of spaces:
-        #echo -n ${(l:$COLUMNS:::):-}
+        # Output an inverse hash and a bunch spaces.  We include
+        # a CR at the end so that any user-input that gets echoed
+        # between this output and the prompt doesn't cause a wrap.
+        print -nP "%B%S#%s%b${(l:$((COLUMNS-1)):::):-}\r"
       }
     fi
   )