mirror of git://git.code.sf.net/p/zsh/code
41242: zstrbcmp(...) removed in favor of zstrcmp(..., SORTIT_IGNORING_BACKSLASHES)
This should make sorting consistent in completion listings vs. elsewhere.
This commit is contained in:
parent
cf72c2d288
commit
efae75f648
|
@ -1,3 +1,8 @@
|
|||
2017-06-17 Barton E. Schaefer <schaefer@zsh.org>
|
||||
|
||||
* 41242: Src/Zle/compcore.c, Src/Zle/zle_tricky.c: zstrbcmp(...)
|
||||
removed in favor of zstrcmp(..., SORTIT_IGNORING_BACKSLASHES)
|
||||
|
||||
2017-06-16 Barton E. Schaefer <schaefer@zsh.org>
|
||||
|
||||
* Wieland Hoffmann: 41265: Functions/Zle/insert-files: quote
|
||||
|
|
|
@ -3135,7 +3135,9 @@ matchcmp(Cmatch *a, Cmatch *b)
|
|||
if ((*b)->disp && !((*b)->flags & CMF_MORDER))
|
||||
return 1;
|
||||
|
||||
return zstrbcmp((*a)->str, (*b)->str);
|
||||
return zstrcmp((*a)->str, (*b)->str, (SORTIT_IGNORING_BACKSLASHES|
|
||||
(isset(NUMERICGLOBSORT) ?
|
||||
SORTIT_NUMERICALLY : 0)));
|
||||
}
|
||||
|
||||
/* This tests whether two matches are equal (would produce the same
|
||||
|
|
|
@ -2407,53 +2407,6 @@ sfxlen(char *s, char *t)
|
|||
}
|
||||
#endif
|
||||
|
||||
/* This is zstrcmp with ignoring backslashes. */
|
||||
|
||||
/**/
|
||||
mod_export int
|
||||
zstrbcmp(const char *a, const char *b)
|
||||
{
|
||||
const char *astart = a;
|
||||
|
||||
while (*a && *b) {
|
||||
if (*a == '\\')
|
||||
a++;
|
||||
if (*b == '\\')
|
||||
b++;
|
||||
if (*a != *b || !*a)
|
||||
break;
|
||||
a++;
|
||||
b++;
|
||||
}
|
||||
if (isset(NUMERICGLOBSORT) && (idigit(*a) || idigit(*b))) {
|
||||
for (; a > astart && 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
#ifndef HAVE_STRCOLL
|
||||
return (int)(*a - *b);
|
||||
#else
|
||||
return strcoll(a,b);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* This is used to print the strings (e.g. explanations). *
|
||||
* It returns the number of lines printed. */
|
||||
|
||||
|
|
Loading…
Reference in New Issue