mirror of
https://github.com/leahneukirchen/cwm.git
synced 2023-08-10 21:13:12 +03:00
Keep the exec menu entries sorted.
Go for it okan@
This commit is contained in:
parent
04441482d4
commit
a0082c58a4
16
search.c
16
search.c
@ -175,13 +175,23 @@ search_match_text(struct menu_q *menuq, struct menu_q *resultq, char *search)
|
||||
void
|
||||
search_match_exec(struct menu_q *menuq, struct menu_q *resultq, char *search)
|
||||
{
|
||||
struct menu *mi;
|
||||
struct menu *mi, *mj;
|
||||
|
||||
TAILQ_INIT(resultq);
|
||||
|
||||
TAILQ_FOREACH(mi, menuq, entry)
|
||||
if (_strsubmatch(search, mi->text, 1))
|
||||
TAILQ_FOREACH(mi, menuq, entry) {
|
||||
if (_strsubmatch(search, mi->text, 1) == 0)
|
||||
continue;
|
||||
for (mj = TAILQ_FIRST(resultq); mj != NULL;
|
||||
mj = TAILQ_NEXT(mj, resultentry)) {
|
||||
if (strcasecmp(mi->text, mj->text) < 0) {
|
||||
TAILQ_INSERT_BEFORE(mj, mi, resultentry);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (mj == NULL)
|
||||
TAILQ_INSERT_TAIL(resultq, mi, resultentry);
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
|
Loading…
x
Reference in New Issue
Block a user