Index | Thread | Search

From:
David Gwynne <david@gwynne.id.au>
Subject:
ddb: make ctrl-w remove trailing space from words too
To:
tech@openbsd.org
Date:
Wed, 22 Apr 2026 16:02:35 +1000

Download raw body.

Thread
this makes ctrl-w in ddb more consistent with the behaviour i experience
in the shell. if you have multiple words, the first ctrl-w will take you
back to the end of the space after the preceding word. if you press
ctrl-w again in the shell it will remove this trailing space before
removing the preceding word. in ddb, it would get stuck on this trailing
space.

Index: db_input.c
===================================================================
RCS file: /cvs/src/sys/ddb/db_input.c,v
diff -u -p -r1.19 db_input.c
--- db_input.c	15 Oct 2020 03:14:00 -0000	1.19
+++ db_input.c	17 Apr 2026 05:42:17 -0000
@@ -171,6 +171,9 @@ db_inputchar(int c)
 		}
 		break;
 	case CTRL('w'):
+		/* erase trailing whitespace after the word */
+		while (db_lc > db_lbuf_start && db_lc[-1] == BLANK)
+			db_delete(1, DEL_BWD);
 		/* erase word back */
 		while (db_lc > db_lbuf_start && db_lc[-1] != BLANK)
 			db_delete(1, DEL_BWD);