From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8199 invoked by alias); 19 Mar 2014 10:51:10 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 18632 Received: (qmail 12594 invoked from network); 19 Mar 2014 10:50:55 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW, T_TO_NO_BRKTS_FREEMAIL autolearn=ham version=3.3.2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=jQeL15qIa8H6WJKr6+F6mxDSd3n0yMxQN++z042GpHY=; b=Tiyp6/Yr0l5gPCbR9OrWqfvE2cN2Tu2beQTgS/luupQLQbZ+H/SZxdh4W9LtKebf0i eHH0S7i7lXD/XK+MXjAQFBe69DjIXx1+6zIX8uezoTpxPU50mFIPEyxXNSP2jn3M4HjX rCo2e0gAkP4aaG1OIGKTWW4HdDSwhTf17tp+t3lbeaaxOX6YLlzVzwlOtAXyY+nfATAV fqCozohzO3wCZzcPLaGLT3kXG2YC5OqL04gJlBzTRyiAC29Qd9QVGFxqwlCiZHgyuWKD VTedRYihc1+rimFyJjDkvw0DIIx43kKlkLHs5P0DN+HNi002bUzi/dKZZa/oFMSXeLra tkqQ== MIME-Version: 1.0 X-Received: by 10.152.19.7 with SMTP id a7mr25436763lae.16.1395226250933; Wed, 19 Mar 2014 03:50:50 -0700 (PDT) Date: Wed, 19 Mar 2014 10:50:50 +0000 Message-ID: Subject: Colours leaking from RPROMPT From: David Banks To: zsh-users@zsh.org Content-Type: text/plain; charset=ISO-8859-1 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