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

Re: 3.0.5: PROMPT and output on the same line



>hal:/usr/src# zsh -f
>hal# echo -n hi
>hal# sh
># echo -n hi
>hi# csh -f
># echo -n hi
>hi# tcsh -f
># echo -n hi
>hi# ksh
># echo -n hi
>hi# exit
>
>Note that between lines 2 and 3, there's no ``hi''.
>
>This is on FreeBSD -current, using the stock /bin/{c,}sh, pdksh-5.2.13 and
>tcsh-6.08.00.

Using script, I get this:

Script started on Wed 31 Mar 1999 09:24:59 BST
^M^[[m^[[m^[[m^[[Jair% ^[[Kl^H ^He^Hecho -n hi^M^M
hi^M^[[m^[[m^[[m^[[Jair% ^[[Ke^Hexit
script done on Wed 31 Mar 1999 09:25:08 BST

Basically, zsh puts some control characters at the start of the prompt, 
forcing itself to the start of the line.  This also happens with:
#!/usr/local/bin/perl
print "hello";

Since there is no \n, the prompt overwrites the "hello".

Also:
air% echo -n hi; echo ""
hi
air% 

The second echo sends a newline, and the "hi" is visible.

I don't know whether to consider this action a bug or a feature;  certainly, 
it's easy enough to work around and probably simple enough to patch a fix for 
(simply remove the control characters before printing $PS1)

-- 
John Riddoch	Email: jr@xxxxxxxxxxxxxx	Telephone: (01224)262730
Room C4, School of Computer and Mathematical Science
Robert Gordon University, Aberdeen, AB25 1HG
I am Homer of Borg. Resistance is Fu... Ooooh! Donuts!



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