Hi Jan-Christian,

* Jan-Christian Hütter <[email protected]> [2013-11-23 23:19]:
> since I intend to use dmenu as a simple file-browser, it would be
> nice if the C-w shortcut also deleted one slash to the left (but not
> more), i.e., /home/user/_ [C-w] should become /home/_.

Patch attached.

Cheers Jochen
>From 8eb24c2bfbde9edfb0dd1f1ecbe712c60ac49f25 Mon Sep 17 00:00:00 2001
From: Jochen Sprickerhof <[email protected]>
Date: Sat, 16 Feb 2013 17:24:52 +0100
Subject: [PATCH] add / to wordchars

i.e. break words at /.
---
 dmenu.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/dmenu.c b/dmenu.c
index 8d9bbb6..cb3b057 100644
--- a/dmenu.c
+++ b/dmenu.c
@@ -270,9 +270,9 @@ keypress(XKeyEvent *ev) {
 			insert(NULL, 0 - cursor);
 			break;
 		case XK_w: /* delete word */
-			while(cursor > 0 && text[nextrune(-1)] == ' ')
+			while(cursor > 0 && (text[nextrune(-1)] == ' ' || text[nextrune(-1)] == '/'))
 				insert(NULL, nextrune(-1) - cursor);
-			while(cursor > 0 && text[nextrune(-1)] != ' ')
+			while(cursor > 0 && text[nextrune(-1)] != ' ' && text[nextrune(-1)] != '/')
 				insert(NULL, nextrune(-1) - cursor);
 			break;
 		case XK_y: /* paste selection */
-- 
1.8.4.4

Reply via email to