From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-workers@sunsite.dk
Subject: Re: bug in insert-last-word?
Date: Mon, 3 Jan 2005 08:31:29 -0800 (PST) [thread overview]
Message-ID: <Pine.LNX.4.61.0501030759230.32450@toltec.zanshin.com> (raw)
In-Reply-To: <20041221233815.GA26200@lorien.comfychair.org>
On Tue, 21 Dec 2004, Danek Duvall wrote:
> % echo "blah
> dquote>^C
>
> Now insert-last-word will repeatedly add '"blah' to the line, rather than
> cycling through previous lines.
This is somewhat strange.
Start as above, then also type
% { echo frob
cursh>^C
Now invoke insert-last-word repeatedly. You get
% frob
% "blah
% "blahfrob
% "blah"blah
% "blah"blahfrob
% "blah"blah"blah
% "blah"blah"blahfrob
etc. So I think it has something to do with the unclosed quote rather
than with insert-last-word itself.
Sure enough, after some time with gdb, I find:
Breakpoint 1, insertlastword (args=0x8146754)
at ../../../zsh-4.0/Src/Zle/zle_hist.c:457
457 if (lastinsert && lastlen &&
(gdb) p lastinsert
$4 = 0x817c010 "\"blah"
(gdb) p lastlen
$5 = 6
Note that the last insertion recorded was 6 characters, but in fact only 5
characters were actually inserted on the line, because the phantom 6th
character was a NUL byte. This confuses the subsequent insertlastword()
call, so it doesn't delete the previous insertion and doesn't search up to
the next history line.
The trouble lies with this pair of assignments:
s = he->text + he->words[2*n-2];
t = he->text + he->words[2*n-1];
When the quote is unclosed, t - s == 6 when it should count 5.
> I'm seeing this in 4.2.0 and 4.2.1, not 4.0.6.
Not surprising, as 4.0.6 doesn't have the previous history cycling
behavior at all. That was a 4.1.something addition.
prev parent reply other threads:[~2005-01-03 16:32 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-12-21 23:38 Danek Duvall
2005-01-03 16:31 ` Bart Schaefer [this message]
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=Pine.LNX.4.61.0501030759230.32450@toltec.zanshin.com \
--to=schaefer@brasslantern.com \
--cc=zsh-workers@sunsite.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).