Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: since 4.3.4, artifact-appearance at prompt



On Nov 4,  2:16pm, Wayne Davison wrote:
} Subject: Re: since 4.3.4, artifact-appearance at prompt
}
} On Sun, Nov 04, 2007 at 09:48:03AM -0800, Bart Schaefer wrote:
} >       function precmd {
} >         # An efficient version using termcap multi-right:
} >         print -nP '%B%S%#%s%b'      # Output % or #
} >         echotc RI $((COLUMNS - 3))
} >         echo -n '  '                # Output 2 spaces
} >       }
} 
} You should replace the 2-space echo with a print that also outputs a CR:
} 
}        print -n '  \r'

In that case we ought to update both the FAQ, and the C code that
handles PROMPT_SP.  I copied the above right out of the FAQ, except
for changing the first "print".

} Yes, the PROMPT_CR option is going to output a CR too, but it does so
} after enough of a delay that I would sometimes see an inverted % on an
} empty line if my type-ahead echoed between the PROMPT_SP output and the
} PROMPT_CR output.

This appears to be what Russell is experiencing, too.

} It is better to output the %P portion as early as possible in the
} post-command-run code, so outputting it as an actual part of the prompt
} would probably not be desirable.

I'm willing to believe that.

} e.g.:
} 
} PROMPTSP=%{%B%S%}%#%{%s%b%}

The internals of prompting already know that %B%S and %s%b don't occupy
any space.  %{...%} shouldn't be needed there.

} However, an alternative to having the user use %{ ... %} would be to
} have the user just tell us how wide their string is:
} 
} PROMPTSP=1:%B%S%#%s%b

The countprompt() function is exported from prompt.c for ZLE's use, so 
I don't think there's much to be gained there.



Messages sorted by: Reverse Date, Date, Thread, Author