repo: dmenu
action: commit
revision: 
path_from: 
revision_from: fd8b26345a5ce905093f30c2ba5491b7a909747d:
path_to: 
revision_to: 
git.thebackupbox.net
dmenu
git clone git://git.thebackupbox.net/dmenu
commit fd8b26345a5ce905093f30c2ba5491b7a909747d
Author: epoch 
Date:   Tue Jul 29 19:58:00 2025 -0500

    hack in a alt+backspace that acts like it does in bash

diff --git a/dmenu.c b/dmenu.c
index d00e7bfd21a470c1afe0de687a50458136b1536c..
index ..3fc2a8c10b2a0b7ab6b8b39fc7a73e764f3fa711 100644
--- a/dmenu.c
+++ b/dmenu.c
@@ -441,6 +441,13 @@ keypress(XKeyEvent *ev)
 		case XK_f:
 			movewordedge(+1);
 			goto draw;
+		case XK_BackSpace: /* alt+backspace to delete until first / to the left. */
+			while (cursor > 0 && strchr("/", text[nextrune(-1)]))
+				insert(NULL, nextrune(-1) - cursor);
+			while (cursor > 0 && !strchr("/", text[nextrune(-1)]))
+				insert(NULL, nextrune(-1) - cursor);
+			insert("/",nextrune(+1) - cursor); // reinsert the / the got removed to make it act like bash.
+			break;
 		case XK_g: ksym = XK_Home;  break;
 		case XK_G: ksym = XK_End;   break;
 		case XK_h: ksym = XK_Up;    break;

-----END OF PAGE-----