From 282cc4b1b068884308cccec1d615640fbbe6d9f7 Mon Sep 17 00:00:00 2001 From: okan Date: Tue, 6 Dec 2016 21:54:10 +0000 Subject: Add search_print_text(), a default callback for mi->print in menu_filter(). While here, normalize the remaining search_print_* argument paramters. --- menu.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'menu.c') diff --git a/menu.c b/menu.c index c566304..1ea3ea7 100644 --- a/menu.c +++ b/menu.c @@ -16,7 +16,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $OpenBSD: menu.c,v 1.99 2016/12/01 20:28:19 okan Exp $ + * $OpenBSD: menu.c,v 1.100 2016/12/06 21:54:10 okan Exp $ */ #include @@ -196,7 +196,7 @@ menu_complete_path(struct menu_ctx *mc) TAILQ_INIT(&menuq); if ((mi = menu_filter(sc, &menuq, mc->searchstr, NULL, - (CWM_MENU_DUMMY), search_match_path, NULL)) != NULL) { + (CWM_MENU_DUMMY), search_match_path, search_print_text)) != NULL) { mr->abort = mi->abort; mr->dummy = mi->dummy; if (mi->text[0] != '\0') @@ -366,11 +366,7 @@ menu_draw(struct menu_ctx *mc, struct menu_q *menuq, struct menu_q *resultq) } TAILQ_FOREACH(mi, resultq, resultentry) { - if (mc->print != NULL) - (*mc->print)(mi, mc->listing); - else - (void)snprintf(mi->print, sizeof(mi->print), - "%s", mi->text); + (*mc->print)(mi, mc->listing); XftTextExtentsUtf8(X_Dpy, sc->xftfont, (const FcChar8*)mi->print, -- cgit v1.2.3-2-gb3c3