This diff disallows setting blank labels and pressing Esc while editing the current one will leave it unchanged. I don't see the point in allowing empty labels as the windows will just show up as blank entries in the menu.
Also remove `current' variable and just use `cc->label'. Index: kbfunc.c =================================================================== RCS file: /cvs/OpenBSD/xenocara/app/cwm/kbfunc.c,v retrieving revision 1.6 retrieving revision 1.6.4.3 diff -u -p -r1.6 -r1.6.4.3 --- kbfunc.c 22 Dec 2009 13:11:37 -0000 1.6 +++ kbfunc.c 16 Jan 2010 17:01:54 -0000 1.6.4.3 @@ -400,18 +400,17 @@ kbfunc_client_label(struct client_ctx *c { struct menu *mi; struct menu_q menuq; - char *current; TAILQ_INIT(&menuq); - current = cc->label; - - if ((mi = menu_filter(cc->sc, &menuq, "label", current, 1, + if ((mi = menu_filter(cc->sc, &menuq, "label", cc->label, 1, search_match_text, NULL)) != NULL) { - if (cc->label != NULL) - xfree(cc->label); - cc->label = xstrdup(mi->text); - xfree(mi); + if (strlen(mi->text) > 0) { + if (cc->label != NULL) + xfree(cc->label); + cc->label = xstrdup(mi->text); + xfree(mi); + } } }