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

Re: Zsh can't do "echo -n" preceding vared <variable>



> On 17/08/2023 15:45 Budi <budikusasi@xxxxxxxxx> wrote:
> How come Zsh can't perform echo -n that precedes vared <variable>, as
> output is only the vared variable's content preceded by none ?

So it sounds like what you're trying to do is output something on the
same line that will be used for the vared, but without it being part
of the edit.  You can't do that by default as the line editor takes
over the whole screen line and will align back to the start.

What you can do is use "vared -p prompt" to output something at the
start of the line, which doesn't have that problem as vared knows
it's there.

Another thing you can do is set the NO_PROMPT_CR option, which
stops the line editor from performing the carriage return.  It
has bad effects if you are editing multiple lines, however ---
this is the difference from other shells that is the reason
for the usual zsh behaviour.  If you're sure the vared will only
be on a single line, you could set that option locally in a
function.  However, I hope vared -p is what you really need.

pws




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