diff options
author | okan <okan> | 2017-04-25 13:40:33 +0000 |
---|---|---|
committer | okan <okan> | 2017-04-25 13:40:33 +0000 |
commit | 2d9185129bbf40029ae35cbdc9667e1c777593fe (patch) | |
tree | 4f89c96f6bbf84c6f140f2aac24ddafb63023a15 /search.c | |
parent | ab8da6180277713fd99be23ceb341f5ce3a75522 (diff) | |
parent | 15b9a8fe27a72e58f1fb488ebf14c3fcae4b98a9 (diff) | |
download | cwm-2d9185129bbf40029ae35cbdc9667e1c777593fe.tar.gz cwm-2d9185129bbf40029ae35cbdc9667e1c777593fe.tar.xz cwm-2d9185129bbf40029ae35cbdc9667e1c777593fe.zip |
cvsimport
* refs/heads/master: The r1.36 menuq_add() conversion did this one wrong; fix by reverting to the original code which adds to resultentry list, as opposed to the wrong one in menuq_add(). Fixes crash noticed by at least Rickard Gustafsson. Remove 'noresult' (and simplify) as it does nothing and makes the logic around it needless. History doesn't show what this might have been used for in future iterations. search_match_path() isn't supposed to return anything. Move queue init to caller so it's only called once in a few cases. sort Raise the previously focused window, instead of the previous window in the cycle list; seems to match behaviour of other wm's; from Walter Alejandro Iglesias. For {h,v}tile, instead of keeping the master client's {h,v} geometry, expand it to %50 of the area, then fill in the remaining space with the other clients in the same group; from Gerrit Meyerheim.
Diffstat (limited to 'search.c')
-rw-r--r-- | search.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/search.c b/search.c index e50884a..63ebdbd 100644 --- a/search.c +++ b/search.c @@ -148,11 +148,10 @@ static void search_match_path_type(struct menu_q *menuq, struct menu_q *resultq, char *search, int flag) { - char pattern[PATH_MAX]; - glob_t g; - int i; - - TAILQ_INIT(resultq); + struct menu *mi; + char pattern[PATH_MAX]; + glob_t g; + int i; (void)strlcpy(pattern, search, sizeof(pattern)); (void)strlcat(pattern, "*", sizeof(pattern)); @@ -162,7 +161,9 @@ search_match_path_type(struct menu_q *menuq, struct menu_q *resultq, for (i = 0; i < g.gl_pathc; i++) { if ((flag & PATH_EXEC) && access(g.gl_pathv[i], X_OK)) continue; - menuq_add(resultq, NULL, "%s", g.gl_pathv[i]); + mi = xcalloc(1, sizeof(*mi)); + (void)strlcpy(mi->text, g.gl_pathv[i], sizeof(mi->text)); + TAILQ_INSERT_TAIL(resultq, mi, resultentry); } globfree(&g); } @@ -170,7 +171,9 @@ search_match_path_type(struct menu_q *menuq, struct menu_q *resultq, void search_match_path(struct menu_q *menuq, struct menu_q *resultq, char *search) { - return(search_match_path_type(menuq, resultq, search, PATH_ANY)); + TAILQ_INIT(resultq); + + search_match_path_type(menuq, resultq, search, PATH_ANY); } void |