delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2005/05/10/11:47:38

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
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
From: ericblake AT comcast DOT net (Eric Blake)
To: cygwin AT cygwin DOT com
Subject: Re: Strange-Dangerous behaviour in Cygwin [ATTN base-file maintainer]
Date: Tue, 10 May 2005 15:47:10 +0000
Message-Id: <051020051547.6892.4280D77E000CE20C00001AEC22007503300A050E040D0C079D0A@comcast.net>
X-Authenticated-Sender: ZXJpY2JsYWtlQGNvbWNhc3QubmV0

> > Now my question - why can't cygwin have sane defaults for the tty, so that
> > this question doesn't continue to pop up?
> 
> What's a sane setting?  When I open a standard bash console window, this
> simply doesn't happen.  Is $TERM set to "cygwin"?  That's the default
> setting and, as noted, backspace works as expected here.  I tried it with
> `rm -i' but the file didn't get removed when entering "y\bn".  So what?
> 

I think I may have a culprit.  When I run bash in a cmd window:
$ [ctrl-v][backspace]
^H
$ echo $TERM
cygwin

When I run it in an rxvt or xterm window:
$ [ctrl-v][backspace]
^?
$ echo $TERM
xterm

/etc/profile (actually etc/defaults/etc/profile) needs to be updated like so, to match the current default behavior of the cygwin terminal settings:

--- /etc/defaults/etc/profile.orig      2005-03-25 08:50:00.003125000 -0700
+++ /etc/defaults/etc/profile1  2005-05-10 09:40:05.474375000 -0600
@@ -1,4 +1,4 @@
-# base-files version 3.2-1
+# base-files version 3.2-1 -*- sh -*-
 
 # WARNING
 #
@@ -101,7 +101,12 @@
 $ '
 
        if tty --quiet ; then
-               stty erase '^?'
+               case "$TERM" in
+                   cygwin ) stty erase ^H ;;
+                   xterm* | rxvt* ) stty erase '^?' ;;
+                   * ) # unknown terminal type, don't set erase
+                       ;;
+               esac
        fi
        ;;
 ksh*     | -ksh*     | */ksh* | \


Actually, it would be nicer if $TERM of cygwin could treat [backspace] as ^? [0x255] (ASCII delete) like xterm does, since both cygwin and xterm treat [delete] as ^[[3~ [ESC - [ - 3 - ~] rather than ^?.  That way, even a cygwin terminal could see the difference between [ctrl-h] and [backspace], which is a MUST for `emacs -nw'.  But I don't know where to look in the cygwin1.dll source code to make that sort of change.


--
Eric Blake



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