Index | Thread | Search

From:
Alexander Arkhipov <aa@manpager.org>
Subject:
cwm diff to accept ctrl+m and ctrl+j in menus
To:
tech@openbsd.org
Date:
Mon, 29 Jan 2024 15:16:53 +0400

Download raw body.

Thread
  • Alexander Arkhipov:

    cwm diff to accept ctrl+m and ctrl+j in menus

Currently cwm accepts several "tty-like" key bindings:

- C-h instead of backspace
- C-u to clean input
- C-[ instead of escape

Unfortunately, C-m and C-j don't act as return. This diff adds such
behaviour. Also, while preparing the diff I noticed that the C-[ binding
is not documented. Since I was editing the relevant man page section, I
also fixed that in the diff, though perhaps it should be fixed
separately.

--
Alexander

Index: cwm.1
===================================================================
RCS file: /var/cvs/xenocara/app/cwm/cwm.1,v
diff -u -p -r1.66 cwm.1
--- cwm.1	20 Jul 2023 14:39:34 -0000	1.66
+++ cwm.1	29 Jan 2024 11:07:22 -0000
@@ -182,7 +182,7 @@ The following key bindings may be used t
 search and exec dialogs:
 .Pp
 .Bl -tag -width "[Down] or C-s or M-j" -offset indent -compact
-.It Ic [Return]
+.It Ic [Return], C-m No or Ic C-j
 Select item.
 .It Ic [Down], C-s No or Ic M-j
 Next item.
@@ -194,7 +194,7 @@ Backspace.
 Clear input.
 .It Ic C-a
 List all available items.
-.It Ic [Esc]
+.It Ic [Esc] No or Ic C-[
 Cancel.
 .El
 .Pp
Index: menu.c
===================================================================
RCS file: /var/cvs/xenocara/app/cwm/menu.c,v
diff -u -p -r1.110 menu.c
--- menu.c	15 Oct 2022 16:06:07 -0000	1.110
+++ menu.c	29 Jan 2024 10:58:32 -0000
@@ -558,6 +558,12 @@ menu_keycode(XKeyEvent *ev, enum ctltype
 		case XK_A:
 			*ctl = CTL_ALL;
 			break;
+		case XK_m:
+		case XK_M:
+		case XK_j:
+		case XK_J:
+			*ctl = CTL_RETURN;
+			break;
 		case XK_bracketleft:
 			*ctl = CTL_ABORT;
 			break;