From 120e8401074254d39be916ad83bafda9ef25e6a9 Mon Sep 17 00:00:00 2001 From: Quentin Rameau Date: Sat, 19 Dec 2015 09:32:55 +0100 Subject: Add config option for word delimiters Let the user configure word boundaries other than ' ', only works with the portable character set. --- dmenu.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'dmenu.c') diff --git a/dmenu.c b/dmenu.c index a07f8e3..e0c2f80 100644 --- a/dmenu.c +++ b/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 */ -- cgit v1.2.3