zsh-users
 help / color / mirror / code / Atom feed
From: David Banks <amoebae@gmail.com>
To: zsh-users@zsh.org
Subject: Colours leaking from RPROMPT
Date: Wed, 19 Mar 2014 10:50:50 +0000	[thread overview]
Message-ID: <CAOBNZ7Z+GGd_JHN5aE=JB0cBFhjsVoVEr7x8+Q01K-_=8VgJAQ@mail.gmail.com> (raw)

Hi list,

I adapted a right-hand-side prompt for showing the run time of the
last command.  Code looks like this:

    function preexec() {
        timer=${timer:-$(date "+%s.%N")}
    }

    function precmd() {
        if [ -n "$timer" ]; then
            new_timer=$(date "+%s.%N")
            timer_accurate=$(printf "scale=2; %s - %s\n" "$new_timer"
"$timer" | bc)
            timer_show=$(printf "%.2f" "$timer_accurate")
            RPROMPT="%F{cyan}${timer_show}s %{$reset_color%}"
            unset timer
        fi
    }


I see some strange colour behaviour when using completions, though.
For instance, when I complete something with more than one possible
match, the completion menu is all coloured cyan.  And once I accept
one of the options from the completion menu, the unique substring that
was completed remains coloured cyan in the command string.  There are
also a couple of other odd behaviours that are not so easy to trigger.

The value of PS1 is '%n@%{%}%m%{%} %(!.#.$) '.

What would be the cause of this?  As far as I can see, the colour
should always be reset after the prompt string is printed, so it
should never show outside the prompt.

Thanks!
Dave


             reply	other threads:[~2014-03-19 10:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-19 10:50 David Banks [this message]
2014-03-19 22:34 ` Bart Schaefer
2014-03-20 14:53   ` David Banks

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAOBNZ7Z+GGd_JHN5aE=JB0cBFhjsVoVEr7x8+Q01K-_=8VgJAQ@mail.gmail.com' \
    --to=amoebae@gmail.com \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).