This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Strange-Dangerous behaviour in Cygwin [ATTN base-file maintainer]


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]