www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/05/30/14:01:05

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,SARE_MSGID_LONG40,SPF_PASS
X-Spam-Check-By: sourceware.org
MIME-Version: 1.0
In-Reply-To: <416096c60905300033g105ddd7elf96812b0d000f731@mail.gmail.com>
References: <4A1C9952 DOT 8040100 AT cornell DOT edu> <838wkhsm5e DOT fsf AT gnu DOT org> <4A1E7C50 DOT 8020505 AT cornell DOT edu> <416096c60905280702m6e4cb748ic305be3592d81c70 AT mail DOT gmail DOT com> <83ws8042o2 DOT fsf AT gnu DOT org> <4A1FD2B7 DOT 90506 AT cornell DOT edu> <416096c60905290538t1989ba8cq4987a0197c2b61cd AT mail DOT gmail DOT com> <416096c60905291459y37ac57a2le64d451d8c5e640a AT mail DOT gmail DOT com> <20090530055318 DOT GA4569 AT ednor DOT casa DOT cgf DOT cx> <416096c60905300033g105ddd7elf96812b0d000f731 AT mail DOT gmail DOT com>
Date: Sat, 30 May 2009 19:00:46 +0100
Message-ID: <416096c60905301100y7ae87fdfv3daa35558b8d1a71@mail.gmail.com>
Subject: Re: emacs -nw keypad, tpu-edt.el, and C-h
From: Andy Koppe <andy DOT koppe AT gmail DOT com>
To: cygwin AT cygwin DOT com
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

> 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))

Andy

--
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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019