From: "Bart Schaefer" <schaefer@candle.brasslantern.com>
To: zsh-workers@sunsite.auc.dk (Zsh hackers list)
Subject: PATCH: 3.1.6: promptexpand (Re: Weird behaviour with certain PS1-sequences)
Date: Sun, 3 Oct 1999 08:15:10 +0000 [thread overview]
Message-ID: <991003081510.ZM31464@candle.brasslantern.com> (raw)
In-Reply-To: <9909280854.AA28230@ibmth.df.unipi.it>
On Sep 28, 10:54am, Peter Stephenson wrote:
} Subject: Re: Weird behaviour with certain PS1-sequences
}
} Dan Nelson wrote:
} > % zsh -f
} > % PROMPT="%m %n %/ %%"
} > dan dan /home/dan % TERM=dumb
} > dan dan /home/dan %
} > ^ blanks start here and don't stop
}
} Yes, I can see this, and what's going wrong, in the refresh code.
} Unfortunately I'm not sure I understand the logic well enough to fix it,
} though if Geoff doesn't get around to it I will have to try.
I was looking at this because 3.0.6 has the same bug, and I can't figure
out what Geoff thinks is happening either. There doesn't seem to ever be
any reason to output more than `ct' characters unless you're reprinting
from the beginning of the line (which is what the block lower down does,
but after sending a '\r').
However, while experimenting with forcing zsh to take all three branches
of that code, I discovered that there's a bug in promptexpand() when the
%{...%} construct is used -- it leaves garbage characters in the string
beyond the end of the prompt. The following should take care of it.
This reminds me, though, that a while back somebody noticed that zalloc()
called calloc() rather than malloc() and "fixed" it. I wonder if there
are other bugs lurking around because callers of zalloc() assume that they
are getting a zero'd buffer?
Index: Src/prompt.c
===================================================================
@@ -161,7 +161,7 @@
rstring = rs;
Rstring = Rs;
fm = s;
- bp = bufline = buf = zalloc(bufspc = 256);
+ bp = bufline = buf = zcalloc(bufspc = 256);
bp1 = NULL;
trunclen = 0;
putpromptchar(1, '\0');
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
next prev parent reply other threads:[~1999-10-03 8:16 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-09-27 19:14 Weird behaviour with certain PS1-sequences Juhapekka Tolvanen
1999-09-27 19:57 ` Bart Schaefer
1999-09-27 20:03 ` Juhapekka Tolvanen
1999-09-27 22:06 ` Dan Nelson
1999-09-28 8:54 ` Peter Stephenson
1999-10-03 8:15 ` Bart Schaefer [this message]
1999-10-03 9:04 ` PATCH: 3.1.6* (Was: Weird behaviour with certain PS1-sequences) Geoff Wing
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=991003081510.ZM31464@candle.brasslantern.com \
--to=schaefer@candle.brasslantern.com \
--cc=zsh-workers@sunsite.auc.dk \
/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).