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

Re: HIST_IGNORE_DUPS also ignores command lines that differ by a space between quotes



On 2024-03-20 10:46:44 -0700, Bart Schaefer wrote:
> So how about this as a compromise:
> 
> diff --git a/Src/hashtable.c b/Src/hashtable.c
> index 75b06c4ad..e1f575a52 100644
> --- a/Src/hashtable.c
> +++ b/Src/hashtable.c
> @@ -1397,6 +1397,14 @@ histstrcmp(const char *str1, const char *str2)
>  {
>      while (inblank(*str1)) str1++;
>      while (inblank(*str2)) str2++;
> +
> +    /* If significant whitespace has already been eliminated,
(insignificant)
> +     * there is no reason to expend similar effort here.  Also,
> +     * this is more accurate in cases of quoted whitespace.
> +     */
> +    if (isset(HISTREDUCEBLANKS))
> +       return strcmp(str1, str2);

That's OK for me.

The documentation of HIST_IGNORE_DUPS in the man page should also
be corrected / completed.

FYI, I had noticed this issue while I was doing tests on various
inputs (provided by "echo ... | command"), where I had to test
with different numbers of spaces, as they really matter. And I got
surprised that I didn't find some of my inputs in the history.

-- 
Vincent Lefèvre <vincent@xxxxxxxxxx> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)




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