Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Mac OS X Prompt Bug
- X-seq: zsh-workers 28445
- From: Wayne Davison <wayned@xxxxxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: Mac OS X Prompt Bug
- Date: Wed, 24 Nov 2010 11:04:33 -0800
- 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=
- In-reply-to: <20101124160832.GA5062@xxxxxxxxxxxxxxxxxxx>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <BAB9C52A-B68A-4B5A-99C2-F85B310B1380@xxxxxxxxx> <20101124152408.3c901d79@xxxxxxxxxxxxxxxxxxxxxxxxx> <20101124160832.GA5062@xxxxxxxxxxxxxxxxxxx>
- Sender: 4wayned@xxxxxxxxx
On Wed, Nov 24, 2010 at 8:08 AM, Vincent Lefevre <vincent@xxxxxxxxxx> 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..
Messages sorted by:
Reverse Date,
Date,
Thread,
Author