* bug in insert-last-word?
@ 2004-12-21 23:38 Danek Duvall
2005-01-03 16:31 ` Bart Schaefer
0 siblings, 1 reply; 2+ messages in thread
From: Danek Duvall @ 2004-12-21 23:38 UTC (permalink / raw)
To: zsh-workers
Prime by typing an open-quoted argument, and hitting control-C:
% echo "blah
dquote>^C
Now insert-last-word will repeatedly add '"blah' to the line, rather than
cycling through previous lines.
I'm seeing this in 4.2.0 and 4.2.1, not 4.0.6.
Danek
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: bug in insert-last-word?
2004-12-21 23:38 bug in insert-last-word? Danek Duvall
@ 2005-01-03 16:31 ` Bart Schaefer
0 siblings, 0 replies; 2+ messages in thread
From: Bart Schaefer @ 2005-01-03 16:31 UTC (permalink / raw)
To: zsh-workers
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.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2005-01-03 16:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-12-21 23:38 bug in insert-last-word? Danek Duvall
2005-01-03 16:31 ` Bart Schaefer
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).