diff options
author | Přemysl Janouch <p.janouch@gmail.com> | 2015-06-07 05:23:31 +0200 |
---|---|---|
committer | Přemysl Janouch <p.janouch@gmail.com> | 2015-06-07 05:23:31 +0200 |
commit | 5bc259e388ae957ae16cecb6ca3e895ec681d85b (patch) | |
tree | 917358057dad764b9d4b729993cefd1a6edbe71b | |
parent | de2eff73993ce799a17c755546ee08520e8c1348 (diff) | |
download | xK-5bc259e388ae957ae16cecb6ca3e895ec681d85b.tar.gz xK-5bc259e388ae957ae16cecb6ca3e895ec681d85b.tar.xz xK-5bc259e388ae957ae16cecb6ca3e895ec681d85b.zip |
degesch: sort modes on change
-rw-r--r-- | degesch.c | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -4000,6 +4000,12 @@ mode_processor_run (struct mode_processor *self, } } +static int +mode_char_cmp (const void *a, const void *b) +{ + return *(const char *) a - *(const char *) b; +} + static void mode_processor_toggle (struct mode_processor *self, struct str *modes) { @@ -4010,7 +4016,7 @@ mode_processor_toggle (struct mode_processor *self, struct str *modes) if (self->adding) { str_append_c (modes, self->mode_char); - // TODO: sort the modes + qsort (modes->str, modes->len, 1, mode_char_cmp); } else str_remove_slice (modes, pos - modes->str, 1); |