Created
August 3, 2016 02:26
-
-
Save nocd5/1c07fd9ccfbe2f4afea067c53a01f833 to your computer and use it in GitHub Desktop.
Sort Features included (+) or not (-)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/version.c b/src/version.c | |
index f6d56d1..be2eeb9 100644 | |
--- a/src/version.c | |
+++ b/src/version.c | |
@@ -5119,6 +5119,18 @@ ex_version(exarg_T *eap) | |
} | |
} | |
+ static int | |
+featcmp(const void *s1, const void *s2) | |
+{ | |
+ char *p1 = *(char **)s1; | |
+ char *p2 = *(char **)s2; | |
+ while ((*p1 == '+') || (*p1 == '-')) | |
+ ++p1; | |
+ while ((*p2 == '+') || (*p2 == '-')) | |
+ ++p2; | |
+ return STRCMP(p1, p2); | |
+} | |
+ | |
/* | |
* List all features aligned in columns, dictionary style. | |
*/ | |
@@ -5143,6 +5155,8 @@ list_features(void) | |
} | |
width += 1; | |
+ qsort((void *)features, (size_t)nfeat, sizeof(char *), featcmp); | |
+ | |
if (Columns < width) | |
{ | |
/* Not enough screen columns - show one per line */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment