emacs -nw keypad, tpu-edt.el, and C-h

Andy Koppe andy.koppe@gmail.com
Sat May 30 20:36:00 GMT 2009

> One more thing: with your change, Alt can be used to override ^? and
> get ^H instead. Usually though, Ctrl is used as the modifier for this,
> whereas Alt acts as Meta (i.e. it sends a ^[ prefix).

Actually, we could take this one step further. In MinTTY, if Backspace
is set to send ^?, Ctrl+Backspace sends ^_ (i.e. 0x1F) rather than ^H.
This allows that key combination to also be distinguished from Ctrl+H,
e.g. as a shortcut for erasing a whole word, like in many GUI
applications. As it sends a single control character, it can be used
to replace ^W in the terminal settings, with 'stty werase ^_'. (I'm
not suggesting that werase should be set to ^_ by default.) Anyone who
actually wants a ^H can still get that with Ctrl+H.

The Linux console in Opensuse actually does the same thing, and two's
a standard, right? ;)

Here's a patch to do this:

--- fhandler_console.cc
+++ fhandler_console.cc
@@ -316,10 +316,10 @@
            dev_state->nModifiers |= 8;

          /* Adopt the linux standard of translating the backspace key to DEL
-            except when ALT is pressed.  */
+            except when CTRL is pressed, in which case it is translated to ^_.
+         */
          if (input_rec.Event.KeyEvent.wVirtualScanCode == 14)
-           toadd = (control_key_state & (LEFT_ALT_PRESSED | RIGHT_ALT_PRESSED))
-                   ? "" : "\177";
+           toadd = (control_key_state & CTRL_PRESSED) ? CTRL("_") : CDEL;
          else if (wch == 0
              /* arrow/function keys */
              || (input_rec.Event.KeyEvent.dwControlKeyState & ENHANCED_KEY))


Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

More information about the Cygwin mailing list