cygwin/minTTY reads odd signal from delete key

0

So this is an odd situation, especially since this is the (at least) third time I've installed Cygwin in a similar setup, and I've never seen this behavior before.

My setup: Windows 7; Cygwin, with MinTTy as my terminal, BASH as my shell; Microsoft Natural Ergonomic Keyboard 4000 v1.0

What's happening: when typing in a terminal, if I hit the DELETE key, all characters from the beginning of the line to the cursor's position are erased and replaced with "[3~"

Example:

  1. Open a terminal, type in some text, and position cursor, as below

    $ hello im just typing in the terminal

  2. position the cursor after "typ" and hit DELETE

RESULT:

$ [3~ing in the terminal

As I mentioned above, I've actually installed Cygwin on this machine before, with this same keyboard. The DELETE key WORKED before. I even use the same model keyboard with my laptop, which is running Win7 with Cygwin and minTTY in an almost identical setup. On my laptop, I never see this behavior.

Does anyone have ANY idea what I might need to do to fix this? I've googled around and can't find anything.

Thanks so much!

Nate Kennedy

Posted 2013-07-01T18:43:14.193

Reputation: 1

The keycode of the DEL key is \e[3~, whereby \e is the Escape control character. So it looks like Escape is somehow mapped to the the backward-kill-line readline command, with the remaining characters in the keycode then appearing on the command line. Have you got anything in your .inputrc or the various bash startup files that could do that? Do other keys such as the arrow keys work as expected? And what's the TERM variable set to? – ak2 – 2013-07-02T08:53:37.690

Argh; yep, that's probably it. I put the following line in my .inputrc: " Escape: backward-kill-line " I guess that's not doing quite what I thought it would :/

Thanks so much! – Nate Kennedy – 2013-07-03T11:46:04.603

Yep, it's an ancient problem with Unix terminals that the Escape keycode can't properly be told apart from the start of the keycodes for many other keys. Some programs such as 'vim' use a timeout to try to distinguish them, but that's not entirely reliable, and bash/readline doesn't even have that. – ak2 – 2013-07-04T12:28:17.917

No answers