On 11 Jul, Jamie Honan responded to: > > But with RH6.2 that confused the hell out of vi and other programs, so > > I at last woke up to the idea that it wasn't the termcap or terminfo > > databases that were broken, it was my understanding. > > How does it work if not through termcap / terminfo? > Does vim understand the X keyboard stuff as well? Yes, you're right. The fact that xterm emulates a VT100 (or VT102 with Tektronics graphics mode, to be pedantic) doesn't mean it shouldn't have its own termcap/terminfo entry. It just means that its entry should be a superset of the vt100. I discussed it with Ken Yap some more, and we agreed that the termcap/terminfo entry should describe the escape sequence generated by the arrow keys. But didn't appear to. Now, I dug up some extra stuff last night. An xterm in vt100 mode has several modes of operation - under VT Options there's "Enable Application Cursor Keys". The default mode makes the keys generate ESC [ A etc., the other mode generates the ESC O A etc. sequence that termcap/terminfo proclaim. And which appear in the entry for vt100, too, which seems equally wrong. So, one assumes that you're supposed to go into this application mode when you switch into visual-editing mode. But the escape sequence which I thought controlled this (smcup/rmcup -- enter_ca_mode and exut_ca_mode) did *not* have any effect. The arrow key sequences didn't change. So in the end I gave up, and changed the definitions for xterm in termcap and terminfo, like I've been doing for the last 10 years. Sigh. Though at least the editor is now using the modern termios system. Note: the xterm-class terminal program "rxvt" doesn't have this option - it always generates ESC [ A etc., and is still considered to have terminal type "xterm". So changing these files is the right thing to do for these other xterm-like programs - I think. > My O'Reilly 'termcap & terminfo' (long story why I bought it) > lists kcud1 (kd termcap) and kcub1 (kl - also correcsponds to bs and bc) > as down and left resp. You're right. That was the other thing - once I'd decided that they were the right capability names to be using, I changed my program to grab those, and changed termcap and terminfo/x/xterm. > terminfo / termcap may not be enough. The crisp editor defines lots > more inside its macro language (because it does 'brief' emulation > - things like shift numeric 5) (I mean the source examinable older > version of crisp). Yeah, but my editor is really simple - it only uses about a dozen keys. Besides, the new terminfo with termios seems pretty exhaustive - it includes shifted numeric key definitions, and so forth. > Also be aware you can set keycodes yourself, using loadkeys. > And of course, xmodmap and the keymap table in X. I know, but there are limits! :-) I just decided that if people fiddle with that stuff, then they are probably aware of the consequences on simple-minded curses programs. But still bugs the hell out of me is how vi (vim) and the real vi (nvi) get it right, whether the termcap/terminfo definition is right or not. I.e. they work before and after my correction, which makes no sense to me. Not to mention X text widgets and Tk/Tcl edit widgets. I can't imagine what magic they're doing to get it right. I'm still missing something big, here. :-( At least the editor works on my systems at home, now, though. (I finally upgraded from RH 4.2 to 6.2 on both machines at home, which is what triggered all this.) luke -- SLUG - Sydney Linux User Group Mailing List - http://slug.org.au/ More Info: http://slug.org.au/lists/listinfo/slug
