commit 120e8401074254d39be916ad83bafda9ef25e6a9 from: Quentin Rameau via: Hiltjo Posthuma date: Sat Dec 19 19:32:14 2015 UTC Add config option for word delimiters Let the user configure word boundaries other than ' ', only works with the portable character set. commit - 32f2564dbbbf5aeafb7190a3d35066142f34448f commit + 120e8401074254d39be916ad83bafda9ef25e6a9 blob - a9122f73add3418911a1b8a4b58c7b95796c43cb blob + 8db1ddadfa328a88293fde2ec81ddef6f70d74e9 --- config.def.h +++ config.def.h @@ -15,3 +15,9 @@ static const char *outbgcolor = "#00ffff"; static const char *outfgcolor = "#000000"; /* -l option; if nonzero, dmenu uses vertical list with given number of lines */ static unsigned int lines = 0; + +/* + * Characters not considered part of a word while deleting words + * for example: " /?\"&[]" + */ +static const char worddelimiters[] = " "; blob - a07f8e32145faae2a9ca75dfab9c6681617ea148 blob + e0c2f80444f9fb8b3ad4f864d16e8b358117b29e --- dmenu.c +++ dmenu.c @@ -314,9 +314,11 @@ keypress(XKeyEvent *ev) insert(NULL, 0 - cursor); break; case XK_w: /* delete word */ - while (cursor > 0 && text[nextrune(-1)] == ' ') + while (cursor > 0 && strchr(worddelimiters, + text[nextrune(-1)])) insert(NULL, nextrune(-1) - cursor); - while (cursor > 0 && text[nextrune(-1)] != ' ') + while (cursor > 0 && !strchr(worddelimiters, + text[nextrune(-1)])) insert(NULL, nextrune(-1) - cursor); break; case XK_y: /* paste selection */