Index | Thread | Search

From:
Claudio Jeker <cjeker@diehard.n-r-g.com>
Subject:
Re: ddb: make ctrl-w remove trailing space from words too
To:
David Gwynne <david@gwynne.id.au>
Cc:
tech@openbsd.org
Date:
Wed, 22 Apr 2026 10:43:53 +0200

Download raw body.

Thread
On Wed, Apr 22, 2026 at 04:02:35PM +1000, David Gwynne wrote:
> 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);
> 

OK claudio@

-- 
:wq Claudio