about summary refs log tree commit diff
path: root/Src
diff options
context:
space:
mode:
authorBart Schaefer <schaefer@zsh.org>2024-04-01 22:29:07 -0700
committerBart Schaefer <schaefer@zsh.org>2024-04-01 22:29:07 -0700
commit5ba43e58c269100a6e3adcfc118ae93346ba0165 (patch)
tree33e21c4ebe536fde585c98e00361644b637ffdc8 /Src
parentf57ad185b31e927bffc8e24566ef0584bddce5bb (diff)
downloadzsh-5ba43e58c269100a6e3adcfc118ae93346ba0165.tar.gz
zsh-5ba43e58c269100a6e3adcfc118ae93346ba0165.tar.xz
zsh-5ba43e58c269100a6e3adcfc118ae93346ba0165.zip
52781: HIST IGNORE_DUPS + HIST_REDUCE_BLANKS treats whitespace as significant
Diffstat (limited to 'Src')
-rw-r--r--Src/hashtable.c8
1 files changed, 8 insertions, 0 deletions
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))