about summary refs log tree commit diff
path: root/Src/Zle
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>1999-10-27 08:38:09 +0000
committerTanaka Akira <akr@users.sourceforge.net>1999-10-27 08:38:09 +0000
commit8eb2c90530262f8ac4e7515ae7da556dabb7185b (patch)
treefa8c2ba7433a8c3be08cc78bc4963364f82583db /Src/Zle
parent6ff88c893913cf73fb6f695817f50e7659b6fe74 (diff)
downloadzsh-8eb2c90530262f8ac4e7515ae7da556dabb7185b.tar.gz
zsh-8eb2c90530262f8ac4e7515ae7da556dabb7185b.tar.xz
zsh-8eb2c90530262f8ac4e7515ae7da556dabb7185b.zip
zsh-workers/8439
Diffstat (limited to 'Src/Zle')
-rw-r--r--Src/Zle/zle_tricky.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/Src/Zle/zle_tricky.c b/Src/Zle/zle_tricky.c
index e0687161f..a5f6dbc88 100644
--- a/Src/Zle/zle_tricky.c
+++ b/Src/Zle/zle_tricky.c
@@ -5529,12 +5529,34 @@ strbpcmp(char **aa, char **bb)
 	if (*b == '\\')
 	    b++;
 	if (*a != *b)
-	    return (int)(*a - *b);
+	    break;
 	if (*a)
 	    a++;
 	if (*b)
 	    b++;
     }
+    if (isset(NUMERICGLOBSORT) && (idigit(*a) || idigit(*b))) {
+	for (; a > *aa && idigit(a[-1]); a--, b--);
+	if (idigit(*a) && idigit(*b)) {
+	    while (*a == '0')
+		a++;
+	    while (*b == '0')
+		b++;
+	    for (; idigit(*a) && *a == *b; a++, b++);
+	    if (idigit(*a) || idigit(*b)) {
+		int cmp = (int) STOUC(*a) - (int) STOUC(*b);
+
+		while (idigit(*a) && idigit(*b))
+		    a++, b++;
+		if (idigit(*a) && !idigit(*b))
+		    return 1;
+		if (idigit(*b) && !idigit(*a))
+		    return -1;
+
+		return cmp;
+	    }
+	}
+    }
     return (int)(*a - *b);
 }