Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: histlexwords error with >! token



On Sun, Jan 25, 2015 at 8:59 PM, Bart Schaefer
<schaefer@xxxxxxxxxxxxxxxx> wrote:
> On Jan 25,  7:52pm, Mikael Magnusson wrote:
> } Subject: histlexwords error with >! token
> }
> } Even though the code appears to specially handle it, I still get this error,
> }  hist.c:3477: bad(1) wordsplit reading history: echo hello >! /dev/null
> } at: >! /dev/null
> } word: >|
>
> Try this:
>
>
> diff --git a/Src/hist.c b/Src/hist.c
> index 11d9722..87d0723 100644
> --- a/Src/hist.c
> +++ b/Src/hist.c
> @@ -3452,7 +3452,8 @@ histsplitwords(char *lineptr, short **wordsp, int *nwordsp, int *nwordposp,
>                         if (*lptr == *wptr ||
>                             (*lptr == '!' && *wptr == '|')) {
>                             lptr++;
> -                           wptr++;
> +                           if (!*++wptr)
> +                               break;
>                         } else if (lptr[0] == '\\' &&
>                                    lptr[1] == '\n') {
>                             /*

That appears to do the trick. I also tried recalling the words with
insert-last-word and copy-earlier-word and they show up as expected
even when they contain spaces, which wasn't the case before the patch.

-- 
Mikael Magnusson



Messages sorted by: Reverse Date, Date, Thread, Author