delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/10/16/22:06:19

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-2.2 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS
X-Spam-Check-By: sourceware.org
To: cygwin AT cygwin DOT com
From: Eric Backus <eric_backus AT agilent DOT com>
Subject: Re: [ANNOUNCEMENT] Updated: mintty-0.5.1-1
Date: Sat, 17 Oct 2009 02:05:39 +0000 (UTC)
Lines: 73
Message-ID: <loom.20091017T034020-502@post.gmane.org>
References: <announce DOT 416096c60910121133u54b2cea7m2955e55d6c0d6564 AT mail DOT gmail DOT com> <loom DOT 20091016T193038-322 AT post DOT gmane DOT org> <416096c60910161104t1d5c1174oab298aeea800cdbf AT mail DOT gmail DOT com>
Mime-Version: 1.0
User-Agent: Loom/3.14 (http://gmane.org/)
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.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

Andy Koppe <andy.koppe <at> gmail.com> writes:

> 2009/10/16 Eric Backus:
> > Unfortunately, cygwin's terminfo/termcap entries for XTERM say that the
> > backspace key returns ^H.  This can be seen by looking in /etc/termcap for
> > xterm, and finding the 'kb' property for that entry, or by running 'infocmp
> > xterm' and looking for the 'kbs' property.
> >
> > So, by default, mintty now does not match the terminfo/termcap entries.  Is
> > there any way to fix this?  I hesitate to suggest changing the
> > terminfo/termcap entries, since they should match the real xterm.  But
> > actually I don't run X11, so I don't know if the current terminfo/termcap
> > really match xterm - the date on /etc/termcap at least is fairly old.
> 
> xterm does still send ^H, but I agree both xterm and its termcap entry
> ought to be changed to match the new Cygwin 1.7 default and the Linux
> world. I should have a look at how to do that.

I suppose that is probably the best solution, but it does require changes in 
three different packages: termcap, terminfo and xterm.  In passing, I'll note 
that xterm on my very old and out-of-date SuSE linux installation uses DEL, so 
matches your new version of mintty.


> Have you come across an application that stumbles over this? All the
> one's I've tried seemed to go by the stty setting rather than the
> termcap entry anyway.

Off the top of my head, I don't know of any application that has a problem.  
As you say, I think most use stty rather than terminfo.  My problem, and the 
reason I stumbled on this, is historical and of my own making.

Over the years, I've used many different terminal emulators on HP-UX, Linux, 
and Windows, and they haven't always started with the correct stty setting for 
the backspace key.  Several programs rely on the stty setting, 
including 'less' and 'emacs', so I wanted to correct the stty setting.  To do 
that, I have code like this in my .profile:

    x=`tput kbs | od -to1 -An`
    x=`echo $x`
    if [ -n "$x" ]; then stty erase 0$x; fi
    unset x

Basicly, this sets the stty erase character to match what the terminfo 
database says is correct.  This code has worked reasonably well for quite some 
years now, and should be a no-op if everything is working correctly.

But this is what is causing my problem with mintty, since now I'm overwriting 
the stty setting (which was correct) with the incorrect value from terminfo.  
Since this problem is unlikely to affect people who simply ignore terminfo, I 
suppose it should not be high priority.


> The workaround is to stick the following somewhere in your startup files:
> 
> echo $'\e[?67h'
> stty erase '^H'

Sure, if I know that the terminal that I'm using is mintty, that is a good 
workaround.  But I try to use the same .profile on both my linux and cygwin 
environments, and I'd prefer it to work with other terminals than just 
mintty.  If there was a portable way to determine whether I'm running within 
mintty, I could use the above escape sequence, but I don't know of a good way 
to determine if I'm in mintty.  The obvious method would be to check $TERM, 
but of course that doesn't work...


> ps: Oh gawd, how I hate this issue.

Oh, believe me, I feel your pain.  Like DOS 8.3 filenames, everyone hates it, 
but it never really goes away.




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

- Raw text -


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