Summary: | Problems with vim7 and backspace | ||
---|---|---|---|
Product: | Gentoo Linux | Reporter: | Lluís Batlle i Rossell <viric> |
Component: | Current packages | Assignee: | Vim Maintainers <vim> |
Status: | RESOLVED UPSTREAM | ||
Severity: | normal | ||
Priority: | High | ||
Version: | unspecified | ||
Hardware: | x86 | ||
OS: | Linux | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- |
Description
Lluís Batlle i Rossell
2006-11-04 17:55:54 UTC
Hmm, the backspace key works fine for me in a plain xterm. I'm using LANG and LC_ALL="en_US.UTF8" While in insert mode, it removes the previous character, as expected. Otherwise, it just moves the cursor back by one character. Are you still having problems with this using the gentoo ebuilds? Hmm, looks like my xterm is set to do: erase = ^H; So, I'm wondering why yours is using a different erase character. Maybe you're on a non-US layout keyboard or something? (In reply to comment #1) > Hmm, the backspace key works fine for me in a plain xterm. I'm using LANG and > LC_ALL="en_US.UTF8" > > While in insert mode, it removes the previous character, as expected. > Otherwise, it just moves the cursor back by one character. Are you still having > problems with this using the gentoo ebuilds? I've not tried the newer ebuilds, but the vanilla vim7 code did the same. I've not tested it again since my post here, and I've kept using 6.4. > > Hmm, looks like my xterm is set to do: erase = ^H; I've tried in the xterm in my workplace (not at home), and there is also ^? there. And there I use 'us' layout, with locale en_US.ISO-8859-1. > > So, I'm wondering why yours is using a different erase character. Maybe you're > on a non-US layout keyboard or something? Sure. At home I use concretely "es+eo,ru", where 'eo' are addon keys for esperanto. I have LANG="ca_ES.UTF-8" and LANGUAGE="ca_ES:ru_RU:es_ES". I found the problem! There are several things affecting: - termcap definition (^H) - stty (^? in my case, which vim7 seemed to ignore, I don't know why) stty was determined in xterm by: - backarrow* respources (affected by xterm compilation flags), - *VT100.Translations resource - *ttyModes resource In my system there was VT100 and ttyModes resources set: *VT100.Translations: #override \ <Key>BackSpace: string(0x7F) *ttyModes: erase ^? The first makes xterm send ^?, and the second makes xterm configure stty with ^? for erase. This should make vim work, but it didn't in my system. Only vim6.4 with the gentoo patches or configure parameters worked (I still don't know why). Vim 7 also from gentoo didn't work. Any vim6.4 or vim7 vanilla also didn't work. I guess there's something broken with vim and stty in my system, but I don't know what. My solution was removing named the resources, and leave everything on default, with ^H in xterm. I don't remember why I ever set ^? for xterm. If I find why vim fails on stty, I'll let know. Further investigation showed that the problem is in _xterm_. vim, detecting an xterm, asks the xterm version. Look at may_req_termresponse(). This is run only if "esckeys" is enabled - which in turn is logical according to the first analysis in #vim at irc. xterm, sending its version, sends some terminal commands, between them, overwriting the "backspace" to ^H, although it's configured for ^?. I'll try to look at the xterm code where this thing is bad. Ok, I found the bug in xterm! When vim asks the xterm for the "backspace" character using a DCS request, xterm answers _always_ ^H. This is in the line input.c:770 of xterm version 222. There's hardcoded: on a termcap request, if the key asked is backspace, return "8" (that is, ^H). That's completely _hardcoded_, regardless of the xresources configuration. Sorry, Lluís, but I think I'm out of suggestions. This is a bug with the source code of the package, so I'd suggest you send a message to the vim-dev mailing list and folks will be able to help you better there. When Bram releases an official patch, I'll include it in Gentoo. See http://www.vim.org/maillist.php for more info on posting to vim-dev. I already notified the xterm developer, as the problem isn't in vim. He acknowledged the problem, and said that he will look for a way to fix it. Thank you for your attention! For anyone who gets here (as I did) via google, some places still have this issue. I have been using one such place pretty heavily, alas. Good workaround if you can't/don't want to install a new version of xterm or whatever is to simply go into your .vimrc (in vim) and add the following: set t_kb=^? Note that you don't want to type '^' and then '?', but rather hit <backspace>; this should create a ^? symbol (or, if you have some similar bug, whatever symbol it thinks is backspace). |