zsh-workers
 help / color / mirror / code / Atom feed
* Zsh clears prompt line. Feature or bug?
@ 2005-04-06 18:59 Joel Kaasinen
  2005-04-07 17:27 ` DervishD
  0 siblings, 1 reply; 13+ messages in thread
From: Joel Kaasinen @ 2005-04-06 18:59 UTC (permalink / raw)
  To: zsh-workers

I changed form bash to zsh some time ago and it's been a pleasure to
use zsh. Except for one thing that irks me: Zsh clears the contents of
the line the prompt gets printed on. An example:

% echo -n "foo"
%

Bash handles this (IMO) more gracefully:

$ echo -n "foo"
foo$

The question is: can I turn this off in zsh? Is it a feature or a bug?

Regards,
Joel

PS. Please CC a response to my address, joel.kaasinen __at__
gmail.com, I haven't subscribed yet.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Zsh clears prompt line. Feature or bug?
  2005-04-06 18:59 Zsh clears prompt line. Feature or bug? Joel Kaasinen
@ 2005-04-07 17:27 ` DervishD
  2005-04-07 18:01   ` Joel Kaasinen
  0 siblings, 1 reply; 13+ messages in thread
From: DervishD @ 2005-04-07 17:27 UTC (permalink / raw)
  To: Joel Kaasinen; +Cc: zsh-workers

    Hi Joel :)

 * Joel Kaasinen <joel.kaasinen@gmail.com> dixit:
> I changed form bash to zsh some time ago and it's been a pleasure to
> use zsh. Except for one thing that irks me: Zsh clears the contents of
> the line the prompt gets printed on. An example:
> 
> % echo -n "foo"
> %
> 
> Bash handles this (IMO) more gracefully:
> 
> $ echo -n "foo"
> foo$
> 
> The question is: can I turn this off in zsh? Is it a feature or a bug?

    Feature. Try 'setopt nopromptcr'. I think this is in the FAQ.
Anyway I think this is, by far, the most asked question in this list
XDDDDD

    Hope that helps :)

    Raúl Núñez de Arenas Coronado

-- 
Linux Registered User 88736
http://www.dervishd.net & http://www.pleyades.net/
It's my PC and I'll cry if I want to...


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Zsh clears prompt line. Feature or bug?
  2005-04-07 17:27 ` DervishD
@ 2005-04-07 18:01   ` Joel Kaasinen
  2005-04-07 18:15     ` DervishD
  0 siblings, 1 reply; 13+ messages in thread
From: Joel Kaasinen @ 2005-04-07 18:01 UTC (permalink / raw)
  To: Joel Kaasinen, zsh-workers

Thanks. Now I can be sure that zsh totally rules :)
I browsed the faq before posting and didn't notice a mention of this.

J

PS. I also updated the zsh vs bash section on my homepage:
http://hanki.no-ip.org/~opqdonut/stuff.shtml

On Apr 7, 2005 8:27 PM, DervishD <zsh@dervishd.net> wrote:
>     Hi Joel :)
> 
>  * Joel Kaasinen <joel.kaasinen@gmail.com> dixit:
> > I changed form bash to zsh some time ago and it's been a pleasure to
> > use zsh. Except for one thing that irks me: Zsh clears the contents of
> > the line the prompt gets printed on. An example:
> >
> > % echo -n "foo"
> > %
> >
> > Bash handles this (IMO) more gracefully:
> >
> > $ echo -n "foo"
> > foo$
> >
> > The question is: can I turn this off in zsh? Is it a feature or a bug?
> 
>     Feature. Try 'setopt nopromptcr'. I think this is in the FAQ.
> Anyway I think this is, by far, the most asked question in this list
> XDDDDD
> 
>     Hope that helps :)
> 
>     Raúl Núñez de Arenas Coronado
> 
> --
> Linux Registered User 88736
> http://www.dervishd.net & http://www.pleyades.net/
> It's my PC and I'll cry if I want to...
>


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Zsh clears prompt line. Feature or bug?
  2005-04-07 18:01   ` Joel Kaasinen
@ 2005-04-07 18:15     ` DervishD
  2005-04-07 22:55       ` Bart Schaefer
  0 siblings, 1 reply; 13+ messages in thread
From: DervishD @ 2005-04-07 18:15 UTC (permalink / raw)
  To: Joel Kaasinen; +Cc: zsh-workers

    Hi Joel :)

 * Joel Kaasinen <joel.kaasinen@gmail.com> dixit:
> Thanks. Now I can be sure that zsh totally rules :)

    That's for sure ;))

> I browsed the faq before posting and didn't notice a mention of this.

    I just thought that was in the FAQ because it is asked here quite
frequently. I've not read the FAQ recently O:)

    Raúl Núñez de Arenas Coronado

-- 
Linux Registered User 88736
http://www.dervishd.net & http://www.pleyades.net/
It's my PC and I'll cry if I want to...


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Zsh clears prompt line. Feature or bug?
  2005-04-07 18:15     ` DervishD
@ 2005-04-07 22:55       ` Bart Schaefer
  2005-04-08  8:43         ` Oliver Kiddle
  0 siblings, 1 reply; 13+ messages in thread
From: Bart Schaefer @ 2005-04-07 22:55 UTC (permalink / raw)
  To: Joel Kaasinen, zsh-workers

On Apr 7,  8:15pm, DervishD wrote:
}
}  * Joel Kaasinen <joel.kaasinen@gmail.com> dixit:
} > I browsed the faq before posting and didn't notice a mention of this.
} 
}     I just thought that was in the FAQ

It is.

3.23. How do I prevent the prompt overwriting output when there is no newline?


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Zsh clears prompt line. Feature or bug?
  2005-04-07 22:55       ` Bart Schaefer
@ 2005-04-08  8:43         ` Oliver Kiddle
  2005-04-08 10:09           ` Bart Schaefer
  0 siblings, 1 reply; 13+ messages in thread
From: Oliver Kiddle @ 2005-04-08  8:43 UTC (permalink / raw)
  To: zsh-workers

Bart wrote:
> 3.23. How do I prevent the prompt overwriting output when there is no newline?

This reminds me. I've been using the following modification to the print
80 spaces solution:

  precmd() { print -n "${(l.$COLUMNS.)}\e7${(l.$COLUMNS..\b.)}\e8\015" }

That's 80 spaces, save cursor position, 80 backspaces, restore cursor.
The \015 is not part of it: that resets the font.

On at least xterm, pterm and dtterm, this solves the problem with
selecting text. The problem with just printing 80 spaces was that if you
then selected the last line with the mouse, it would select the spaces
instead of a newline. The problem with Bart's $'\e[6n' solution is that
the key buffer is lost so if you had already started typing the next
command, it'd be lost when precmd() ran.

Oliver



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Zsh clears prompt line. Feature or bug?
  2005-04-08  8:43         ` Oliver Kiddle
@ 2005-04-08 10:09           ` Bart Schaefer
  2005-04-08 10:15             ` Bart Schaefer
  2005-04-08 11:00             ` Oliver Kiddle
  0 siblings, 2 replies; 13+ messages in thread
From: Bart Schaefer @ 2005-04-08 10:09 UTC (permalink / raw)
  To: zsh-workers

On Apr 8, 10:43am, Oliver Kiddle wrote:
} Subject: Re: Zsh clears prompt line. Feature or bug?
}
}   precmd() { print -n "${(l.$COLUMNS.)}\e7${(l.$COLUMNS..\b.)}\e8\015" }
} 
} That's 80 spaces, save cursor position, 80 backspaces, restore cursor.

Doesn't work for me.

For one thing, I have to use ${(l.COLUMNS+COLUMNS..\b.)} to get the
cursor back to where it started, because "\b" counts as 2 characters
in (l.80..\b.) so that only prints 40 of them.  I don't know what you
did differently to get \b to be a backspace *before* it was sized.
Maybe you have a cut'n'paste-o and it should be ${(pl.COLUMNS..\b.)} ?

And even then, my backspaces aren't destructive, so I can still select
the spaces that were printed.

The following works, but only if I have "enable reverse wraparound" on,
lack of which state I don't (yet) know how to detect:

  print -P "${(l.COLUMNS.. .)}${(pl.COLUMNS..\b.)}%E"

} The \015 is not part of it: that resets the font.

Huh?  $'\015' is just $'\r', isn't it?


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Zsh clears prompt line. Feature or bug?
  2005-04-08 10:09           ` Bart Schaefer
@ 2005-04-08 10:15             ` Bart Schaefer
  2005-04-08 11:00             ` Oliver Kiddle
  1 sibling, 0 replies; 13+ messages in thread
From: Bart Schaefer @ 2005-04-08 10:15 UTC (permalink / raw)
  To: zsh-workers

On Apr 8, 10:09am, Bart Schaefer wrote:
}
}   print -P "${(l.COLUMNS.. .)}${(pl.COLUMNS..\b.)}%E"

Oops, that was my own cut-n-paste-o.  I meant:

  print -nP "${(l.COLUMNS.. .)}\e[s${(pl.COLUMNS..\b.)}%E\e[u"

(where \e[s and \e[u are the ANSI equivalent of \e7 and \e8 for VT100).


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Zsh clears prompt line. Feature or bug?
  2005-04-08 10:09           ` Bart Schaefer
  2005-04-08 10:15             ` Bart Schaefer
@ 2005-04-08 11:00             ` Oliver Kiddle
  2005-04-08 15:12               ` Bart Schaefer
  1 sibling, 1 reply; 13+ messages in thread
From: Oliver Kiddle @ 2005-04-08 11:00 UTC (permalink / raw)
  To: zsh-workers

Bart wrote:

> } That's 80 spaces, save cursor position, 80 backspaces, restore cursor.
> 
> Doesn't work for me.

Sorry, it looks like I made a bit of a mess of this when trying to
simplify it. My original used $terminfo.

> Huh?  $'\015' is just $'\r', isn't it?

That should have been \017.

Oliver


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Zsh clears prompt line. Feature or bug?
  2005-04-08 11:00             ` Oliver Kiddle
@ 2005-04-08 15:12               ` Bart Schaefer
  2005-04-08 15:29                 ` DervishD
  2005-04-08 17:47                 ` Oliver Kiddle
  0 siblings, 2 replies; 13+ messages in thread
From: Bart Schaefer @ 2005-04-08 15:12 UTC (permalink / raw)
  To: zsh-workers

On Apr 8,  1:00pm, Oliver Kiddle wrote:
}
} > } That's 80 spaces, save cursor position, 80 backspaces, restore cursor.
} > 
} > Doesn't work for me.
} 
} Sorry, it looks like I made a bit of a mess of this when trying to
} simplify it. My original used $terminfo.

Does that mean that with $terminfo you were able to employ a destructive
backspace?  As I said, for me \b isn't destructive, at least not in the
sense of making it impossible to mouse-select previously-printed spaces.

The next complaint, of course, is going to be that zsh clobbers the word
"RIGHT" in the following:

zsh% echo -n "${(l.COLUMNS-6.. .)}RIGHT\015LEFT"


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Zsh clears prompt line. Feature or bug?
  2005-04-08 15:12               ` Bart Schaefer
@ 2005-04-08 15:29                 ` DervishD
  2005-04-08 16:23                   ` Bart Schaefer
  2005-04-08 17:47                 ` Oliver Kiddle
  1 sibling, 1 reply; 13+ messages in thread
From: DervishD @ 2005-04-08 15:29 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: zsh-workers

    Hi Bart :)

 * Bart Schaefer <schaefer@brasslantern.com> dixit:
> On Apr 8,  1:00pm, Oliver Kiddle wrote:
> The next complaint, of course, is going to be that zsh clobbers the word
> "RIGHT" in the following:
> 
> zsh% echo -n "${(l.COLUMNS-6.. .)}RIGHT\015LEFT"

    I wouldn't complain because my 'echo' needs -e to clobber 'RIGHT'.
OTHO, 'print' clobbers it (correctly) ;))

    Raúl Núñez de Arenas Coronado

-- 
Linux Registered User 88736
http://www.dervishd.net & http://www.pleyades.net/
It's my PC and I'll cry if I want to...


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Zsh clears prompt line. Feature or bug?
  2005-04-08 15:29                 ` DervishD
@ 2005-04-08 16:23                   ` Bart Schaefer
  0 siblings, 0 replies; 13+ messages in thread
From: Bart Schaefer @ 2005-04-08 16:23 UTC (permalink / raw)
  To: zsh-workers

On Apr 8,  5:29pm, DervishD wrote:
} Subject: Re: Zsh clears prompt line. Feature or bug?
}
}  * Bart Schaefer <schaefer@brasslantern.com> dixit:
} > The next complaint, of course, is going to be that zsh clobbers the word
} > "RIGHT" in the following:
} > 
} > zsh% echo -n "${(l.COLUMNS-6.. .)}RIGHT\015LEFT"
} 
}     I wouldn't complain because my 'echo' needs -e to clobber 'RIGHT'.
} OTHO, 'print' clobbers it (correctly) ;))

What I meant was that even if echo or print does not clobber RIGHT, the
printing of the prompt will do so because the output ends in the middle
of the line after LEFT.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Zsh clears prompt line. Feature or bug?
  2005-04-08 15:12               ` Bart Schaefer
  2005-04-08 15:29                 ` DervishD
@ 2005-04-08 17:47                 ` Oliver Kiddle
  1 sibling, 0 replies; 13+ messages in thread
From: Oliver Kiddle @ 2005-04-08 17:47 UTC (permalink / raw)
  To: zsh-workers

Bart wrote:
> Does that mean that with $terminfo you were able to employ a destructive
> backspace?  As I said, for me \b isn't destructive, at least not in the
> sense of making it impossible to mouse-select previously-printed spaces.

Seems I was wrong when saying it worked in xterm. Must have not tested
it right or perhaps the xterm I have at home is different from the one
at work. It does work in pterm, however. Your code in 21119 being as
good as the $terminfo solution.

Closest I can think of for xterm is "\e[1S${(l.COLUMNS.)}\e[1T" but that
still has problems.

Oliver


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2005-04-08 17:48 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-04-06 18:59 Zsh clears prompt line. Feature or bug? Joel Kaasinen
2005-04-07 17:27 ` DervishD
2005-04-07 18:01   ` Joel Kaasinen
2005-04-07 18:15     ` DervishD
2005-04-07 22:55       ` Bart Schaefer
2005-04-08  8:43         ` Oliver Kiddle
2005-04-08 10:09           ` Bart Schaefer
2005-04-08 10:15             ` Bart Schaefer
2005-04-08 11:00             ` Oliver Kiddle
2005-04-08 15:12               ` Bart Schaefer
2005-04-08 15:29                 ` DervishD
2005-04-08 16:23                   ` Bart Schaefer
2005-04-08 17:47                 ` Oliver Kiddle

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).