summary refs log tree commit diff
diff options
context:
space:
mode:
authorokan <okan>2018-01-23 13:51:39 +0000
committerokan <okan>2018-01-23 13:51:39 +0000
commit5324f9a4e321adbad7d5d7014286509aa74d0012 (patch)
tree8e2ac0462588d960bc34fef57c295ce9d3394983
parent8675b5e158aabf4be9be8289f3553d399474e42a (diff)
downloadcwm-5324f9a4e321adbad7d5d7014286509aa74d0012.tar.gz
cwm-5324f9a4e321adbad7d5d7014286509aa74d0012.tar.xz
cwm-5324f9a4e321adbad7d5d7014286509aa74d0012.zip
Shrink tier[] by one after removing matchname in r1.55.
-rw-r--r--search.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/search.c b/search.c
index 7d3bd21..0ab75b2 100644
--- a/search.c
+++ b/search.c
@@ -69,7 +69,7 @@ match_substr(char *sub, char *str, int zeroidx)
 void
 search_match_client(struct menu_q *menuq, struct menu_q *resultq, char *search)
 {
-	struct menu		*mi, *tierp[4], *before = NULL;
+	struct menu		*mi, *tierp[3], *before = NULL;
 	struct client_ctx	*cc;
 	struct winname		*wn;
 
@@ -88,14 +88,14 @@ search_match_client(struct menu_q *menuq, struct menu_q *resultq, char *search)
 		if (tier < 0) {
 			TAILQ_FOREACH_REVERSE(wn, &cc->nameq, name_q, entry)
 				if (match_substr(search, wn->name, 0)) {
-					tier = 2;
+					tier = 1;
 					break;
 				}
 		}
 
 		/* Match on window resource class. */
 		if ((tier < 0) && match_substr(search, cc->ch.res_class, 0))
-			tier = 3;
+			tier = 2;
 
 		if (tier < 0)
 			continue;
@@ -108,9 +108,6 @@ search_match_client(struct menu_q *menuq, struct menu_q *resultq, char *search)
 		if ((tier > 0) && (cc->flags & CLIENT_HIDDEN))
 			tier--;
 
-		if (tier >= nitems(tierp))
-			errx(1, "%s: invalid tier", __func__);
-
 		/*
 		 * If you have a tierp, insert after it, and make it
 		 * the new tierp.  If you don't have a tierp, find the