Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: PATCH: parse from even deeper in hell
On Mon, 23 Feb 2015 12:35:51 +0100
Mikael Magnusson <mikachu@xxxxxxxxx> wrote:
> I figured out that when we assign lineptr after fiddling with it, we
> also need to update start, it records the location of *lineptr on
> entry to the function, and is used to calculate things later on. With
> that addition, the unmetafy + metafy mostly works. insert-last-word
> still gets "stuck" on words that came from the old metafication and
> starts over from the end of history, leaving the old word in place.
What's the line this happens with? Is it the same as the one that
originally failed?
I wonder if it's getting information by some other path, though it seems
strange the last word wouldn't come from the bit we've apparently fixed
up.
> Indeed fc -l lists this line differently still, even though it appears
> correctly in zle.
> 10673* echo mp3info 好きになり\M-c\M-^Aい.mp3
> 10675* echo mp3info 好きになりたい.mp3
That suggests this is indeed a different code path to the one that got
fixed --- it sounds like the same line entered in a new shell is OK so
it can only be that there's some bit of the history that's not fixed.
So we may need the equivalent earlier or elsewhere in addition; the
former would be better.
> This is with the following code, which fixes(?) all the errors and
> seems to make things work pretty well. However, even doing the remeta
> unconditionally, I still get the above result with fc -l and
> insert-last-word. It also happens, unsurprisingly, if I don't use
> hist_lex_words.
That's yet another pointer that the code needs to go elsewhere.
> If I accept a line recalled in this way, the new
> history entry is saved correctly and works fine in new shells.
>
> for (ptr = lineptr; *ptr; ptr++)
> if (*ptr != Meta && imeta(*ptr)) {
> remeta = 1;
> break;
> }
> if (remeta) {
> unmetafy(lineptr, &remeta);
> start = lineptr = metafy(lineptr, remeta, META_USEHEAP);
> }
That looks an entirely reasonable fix for the problem, if we can work
out what's still wrong and move things around.
At worst, ensuring the file gets completely written out from scratch
(turning off INC_APPEND_HISTORY) should fix things for subsequent
shells, whether new or old.
pws
Messages sorted by:
Reverse Date,
Date,
Thread,
Author