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

Possible bug to RPROMPT



Hello,

I've been tinkering with zsh for the past couple weeks, and I'm loving it!

But I think I hit a bug regarding the RPROMPT definition.

Since I setup my PROMPT so the information comes in one line and my cursor
below it, I was trying to align the RPROMPT to always appear 1 line before
where it generally is printed.

This is a bit confuse, but hopefully everything will clear up with an
example. So, lets suppose I have:

PROMPT='a lot of cosmetic and information stuff here.
{colors} > {reset colors}'

So I have a 2 line definition. this works fine.

so I tried

RPROMPT='< [current time]'

this works, BUT it's one line below form where I want it.

so after some tinkering, I decided to try some escape commands:

PROMPT=$'\e[s'$'\e[1A''< [clock] ''$'\e[1B'$'\e[u'

Where:
$'\e[s' - Save current cursor position
$'\e[1A' - go back one line up
<<render stuff between them >>
$'\e[1B' - go one line down
$'\e[u' - Restore cursor position

It worked! But... The cursor ends up on the far left side of the screen,
before any characters that are already printed.  (so, in my example, it
would be before the > printed by PROMPT).

So.. is this a real (possible?) bug, or did I "abuse" too much from the
prompt parameters and broke it ?

Hopefully it's something that can be fixed!

Thank you in advance!

-Felipe


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