From 5ba43e58c269100a6e3adcfc118ae93346ba0165 Mon Sep 17 00:00:00 2001 From: Bart Schaefer Date: Mon, 1 Apr 2024 22:29:07 -0700 Subject: [PATCH] 52781: HIST IGNORE_DUPS + HIST_REDUCE_BLANKS treats whitespace as significant --- ChangeLog | 5 +++++ Src/hashtable.c | 8 ++++++++ 2 files changed, 13 insertions(+) diff --git a/ChangeLog b/ChangeLog index 62b332aae..63034fb5a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2024-04-01 Bart Schaefer + + * 52781 (and typo fix): Src/hashtable.c: HIST IGNORE_DUPS treats + whitespace as significant when HIST_REDUCE_BLANKS is also set. + 2024-04-01 Oliver Kiddle * github #115: OKURA Masafumi: Completion/Unix/Command/_ruby: diff --git a/Src/hashtable.c b/Src/hashtable.c index 75b06c4ad..96675a393 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 insignificant whitespace has already been eliminated, + * 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); + while (*str1 && *str2) { if (inblank(*str1)) { if (!inblank(*str2))