From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15179 invoked by alias); 24 Nov 2010 19:04:41 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 28445 Received: (qmail 23888 invoked from network); 24 Nov 2010 19:04:37 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HTML_FONT_FACE_BAD,HTML_MESSAGE,RCVD_IN_DNSWL_NONE autolearn=no version=3.3.1 Received-SPF: pass (ns1.primenet.com.au: SPF record at _spf.google.com designates 209.85.213.43 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:content-type; bh=LmxWaWpkB5K3LXPJdjuySi+OnenZ0TJI3Da2HNR0p9w=; b=l6LTMgTocCpGmdxfZiuBcDHhqvYmKVM3MUCrpmv/WHVC6+QSYv+R4P/MdbP2XX5tOv LC+UshjHooVbnif1I/Pqi7JHfcVWCQN4+k08PVFXefldebuGs2vvdxeJtwKEYWBki+0k rmd4K3RJYw3OkAfEtAJihNr1plME9JGHVG+g8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:content-type; b=r9tk6rjQhp0RYYVOgYO4ZTKxrO+7mOEtFqUpF+dqk9SULpf3pgmguartvZZpv7i07V oMS81DirYD7+gF8mK085UjNNVSxbsbdmI7Gz/ujReUWS6v9m9xKnzl2Wj/3wMbvNkM4o J/N1fdlToJMjghFTEuqG0r5nWUmgoimic/3/g= MIME-Version: 1.0 Sender: 4wayned@gmail.com In-Reply-To: <20101124160832.GA5062@prunille.vinc17.org> References: <20101124152408.3c901d79@pwslap01u.europe.root.pri> <20101124160832.GA5062@prunille.vinc17.org> Date: Wed, 24 Nov 2010 11:04:33 -0800 X-Google-Sender-Auth: blW047WXX6ip88HZq8H9YwcAhKM Message-ID: Subject: Re: Mac OS X Prompt Bug From: Wayne Davison To: zsh-workers@zsh.org Content-Type: multipart/alternative; boundary=0016e6d976fbe252870495d12836 --0016e6d976fbe252870495d12836 Content-Type: text/plain; charset=UTF-8 On Wed, Nov 24, 2010 at 8:08 AM, Vincent Lefevre wrote: > Couldn't the mark be printed exactly at the same time of the prompt? > That wouldn't be desirable, because it can allow other output to muck things up. The PROMPT_SP needs to happen as soon after the command exits as possible to ensure that its output-idiom has the largest chance of just affecting incomplete output from the program (e.g. we actually want to cover up type-ahead that shows up just prior to the prompt). One thing that could be done to improve the PROMPT_SP heuristic is to output a extra space (assuming the width (w) is 1) and another CR after the trailing CR that is currently output. That would ensure that newlines wouldn't show a superfluous percent when no dangling output was present. So, how about this? --- a/Src/utils.c +++ b/Src/utils.c @@ -1292,9 +1292,7 @@ preprompt(void) countprompt(str, &w, 0, -1); opts[PROMPTPERCENT] = percents; zputs(str, shout); - for (w = (int)columns - w - !hasxn; w > 0; w--) - putc(' ', shout); - putc('\r', shout); + fprintf(shout, "%*s\r%*s\r", (int)columns - w - !hasxn, "", w, ""); free(str); } I'm not sure if that works well for the case where hasxn isn't set, though. We may want to create a separate fprintf() for that case which leaves the no-hasxn case alone: --- a/Src/utils.c +++ b/Src/utils.c @@ -1292,9 +1292,10 @@ preprompt(void) countprompt(str, &w, 0, -1); opts[PROMPTPERCENT] = percents; zputs(str, shout); - for (w = (int)columns - w - !hasxn; w > 0; w--) - putc(' ', shout); - putc('\r', shout); + if (hasxn) + fprintf(shout, "%*s\r%*s\r", (int)columns - w, "", w, ""); + else + fprintf(shout, "%*s\r", (int)columns - w - 1, ""); free(str); } ..wayne.. --0016e6d976fbe252870495d12836--