vile
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [vile] system-mapped-chars


From: Wayne Cuddy
Subject: Re: [vile] system-mapped-chars
Date: Sat, 27 Dec 2014 14:43:13 -0500
User-agent: Mutt/1.4.2.3i

On Fri, Dec 26, 2014 at 08:08:58PM -0500, Thomas Dickey wrote:
> On Fri, Dec 26, 2014 at 02:54:35PM -0500, Wayne Cuddy wrote:
> > On Tue, Dec 23, 2014 at 08:16:11PM -0500, Thomas Dickey wrote:
> > > On Tue, Dec 23, 2014 at 01:02:23PM -0500, Wayne Cuddy wrote:
> > > > Can system-defined maps be adjusted after compile time? It doesn't
> > > > seem so.
> > > 
> > > no - it's built-in...
> > > 
> > > Very briefly, it uses the terminfo/termcap/whatever database for
> > > home/end, and adds in - if asked - the xterm function-keys.
> > > 
> > > The latter isn't much used (but I should rework it, since I've
> > > incorporated much of that into ncurses as extended capabilities).  My
> > > main use for it is to ensure that special keys come in as a special key
> > > rather than individual bytes.
> > >  
> > > but I digress...
> > > 
> > > > I've found that HOME/END keypad keys don't always map to #H/#E
> > > > respectively.
> > > 
> > > That really sounds more like a mismatch between terminal emulator
> > > and terminal database.  (If it's some program setting TERM to "xterm"
> > > but not really xterm, I've been there a lot).
> > > 
> > > Given some more details, I may be able to offer advice.
> > >  
> > > > I've been able to get around this with additional maps for
> > > > terminal-specific sequences in the vilerc file but it would be nice if
> > > > there was an easy way to add to the system maps.
> > > > 
> > > > Wayne
> > > > 
> > 
> > Sorry, took me a bit of research, this was actually an issue for a
> > co-worker. I don't use the HOME/END or really any of the keypad keys, to
> > me that's what makes vi-style editors so efficient.
> > 
> > Aside from Linux we also use HP-UX at the shop. We run HP's OEM xterm as
> > well as rxvt-unicode that we built ourselves. We don't really have a
> > preference except that rxvt tends to be lighter with respect to network
> > I/O between itself and the X-server. This normally isn't noticed but we
> > use a VNC-style terminal server environment and high output/scrolling
> > can have a noticeable effect on the VNC/X host. But this is maybe an
> > xterm discussion for another day.
> 
> yes... rxvt doesn't send all of the screen updates.  I added a feature
> which can make xterm do part of that, a few years ago, to get discussion.

I tested the '-j' option if that is what you are referring to but it
didn't have as much of an effect as I expect.

>  
> > Vile is linked with HP's OEM curses (xcurses) library. Surprisingly the
> > HOME/END keys work as expected in rxvt. In Xterm, either running locally
> > on Linux while ssh'd into an HP host or running HP's xterm via X when
> > the HOME/END keys are used they produce ^[OH and ^[OE respectively.
> 
> Short: the problem can be fixed by correcting the terminal description on
> the HP-UX machine.  I still have access to at least one HP-UX server, and
> can see this description running "infocmp xterm":
> 
> #       Reconstructed via infocmp from file: /usr/share/lib/terminfo/x/xterm
> xterm|vs100|xterm terminal emulator,
>         am, km, xenl,
>         cols#80, lines#65,
>         bel=^G, blink=@, bold=\E[1m, civis=\E[?25I,
>         clear=\E[H\E[2J, cnorm=\E[?25h, cr=\r,
>         csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=\b,
>         cud=\E[%p1%dB, cud1=\E[B, cuf=\E[%p1%dC, cuf1=\E[C,
>         cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A,
>         cvvis=\E[?25h, dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM,
>         dl1=\E[M, ed=\E[J, el=\E[K, home=\E[1;1H, ht=\t,
>         hts=\EH, ich=\E[%p1%d@, ich1=\E[@, il=\E[%p1%dL,
>         il1=\E[L, ind=\n, kbs=\177, kcub1=\EOD, kcud1=\EOB,
>         kcuf1=\EOC, kcuu1=\EOA, kf1=\EOP, kf10=\E[21~,
>         kf11=\E[23~, kf12=\E[24~, kf2=\EOQ, kf3=\EOR,
>         kf4=\EOS, kf5=\E[15~, kf6=\E[17~, kf7=\E[18~,
>         kf8=\E[19~, kf9=\E[20~, knp=\E[6~, kpp=\E[5~, rc=\E8,
>         rev=\E[7m, ri=\EM, rmkx=\E[?1l, rmso=\E[m,
>         rs1=\E>\E[1;3;4;5;6l\E[?7h\E[m\E[r\E[2J\E[H, rs2=@,
>         sc=\E7,
>         sgr=\E[%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;m,
>         sgr0=\E[m, smkx=\E[?1h, smso=\E[7m, tbc=\E[3g,
> 
> I'd fix that by 
>       infocmp xterm >foo
>       --edit foo, adding (a line with a tab at the front):
>               khome=\EOH, kend=\EOE,
>       sudo tic foo

Our HP-UX release is quite old.. 11.23 and 'xterm -v' produces XFree86
4.3.99.15(180). Ha, I see your site and name referenced in the manual
page. I updated the terminfo database using your suggestion above and it
partially fixed the problem. The home key now produces #H but the END
key still produces ^[OF. I removed the khome entry and just added the
kend paramter just for S&Gs with no joy. I wonder why it's not picking
up the kend parameter, I checked and it's not defined earlier in the
description anywhere.

> 
> Long: here's how we got to this point...
> 
> The problem is that different terminal emulators use different character
> sequences for some of the special keys - Home/End are particular problems.
> I've been responsible for some of that, though it was about ten years ago.
> 
> hmm - my faq here isn't that clear:
>       http://invisible-island.net/ncurses/ncurses.faq.html#home_end_keys
> so I'll provide an explanation here, and make a to-do to improve that.
> But see these, where I've done a better explanation:
>       http://invisible-island.net/xterm/xterm.faq.html#xterm_pageup
>       http://invisible-island.net/xterm/xterm.faq.html#xterm_pc_style
> 
> There are a couple of issues:
> 
> a) If you want to pretend that xterm is a vt220, there is no such thing as
>    Home/End.  The corresponding positions on a vt220 keyboard are Select/Find
> 
>    If there's no tinkering with the translations resource, the sunKeyboard
>    resource is the important one.
> 
> b) Some of the terminfo's which I made use the vt220 convention (and is what
>    I'm referring to as "ten years ago".
> 
> c) If the terminfo doesn't match the terminal behavior, the application won't
>    recognize the keys.
> 
> d) Here's a script which I ran to show the differences
> 
>    Note that xterm-r5 and xterm-r6 assume vt220 keyboard -- using different
>    terminfo names -- while the others do not.  Eventually I got it right,
>    but was reluctant to redo longstanding descriptions:
> --------(script)---------------------------------------------------------------
> #!/bin/sh
> for term in xterm-r5 xterm-r6 xterm-xfree86 xterm-new xterm-vt220 rxvt
> do
> echo "** $term"
> case $term in
> xterm-r6)
>       HOME=kfnd
>       END=kslt
>       ;;
> *)
>       HOME=khome
>       END=kend
>       ;;
> esac
> printf "$HOME:";tput -T$term $HOME |cat -v; echo
> printf "$END:";tput -T$term $END |cat -v; echo
> done
> --------(output)---------------------------------------------------------------
> ** xterm-r5
> khome:^[[1~
> kend:^[[4~
> ** xterm-r6
> kfnd:^[[1~
> kslt:^[[4~
> ** xterm-xfree86
> khome:^[OH
> kend:^[OF
> ** xterm-new
> khome:^[OH
> kend:^[OF
> ** xterm-vt220
> khome:^[[1~
> kend:^[[4~
> ** rxvt
> khome:^[[7~
> kend:^[[8~
> -------------------------------------------------------------------------------
> rxvt isn't a problem because I wasn't there improving its keyboard
> configurabilty (essentially it's hardcoded to one choice - xterm has
> several features which multiply to a lot of choices, and the blunder
> that I noted in the last link above was due to overlooking a customization
> that I was testing...).
>  
> > On top of that the user wanted the HOME/END keys to operate on the
> > current line instead of the entire file. So here are the vilerc
> > entries I created.
> > 
> > ----------------------------------------------------------------------
> > map #H 0
> > map #E $
> > map! #H ^[0i
> > map! #E ^[A
> > 
> > ; Handle HP Xterm
> 
> Actually, "recent" HP Xterm is a version from my development (at least
> that's what is installed on the machine I can inspect).  You can check
> this by typing
>       xterm -v
> to see if it prints a version message.  (If it simply runs xterm, then
> it's _very_ old).
> 
> It is actually 11 years old.  But (looking at the terminal description
> which I quoted above), the terminfo database does not appear to have
> been updated past X11R5, about 20 years ago.
> 
> > map ^[OH 0
> > map ^[OF $
> > map! ^[OF ^[A
> > map! ^[OH ^[0i
> > ----------------------------------------------------------------------
> > 
> > The above tends to work quite well so perhaps this is sufficient. I
> > was just surprised that the HP Xterm didn't produce #H/#E forcing me
> > to map the terminal escapes.
> > 
> > Thanks again,
> > Wayne
> > 
> > _______________________________________________
> > vile mailing list
> > address@hidden
> > https://lists.nongnu.org/mailman/listinfo/vile
> 
> -- 
> Thomas E. Dickey <address@hidden>
> http://invisible-island.net
> ftp://invisible-island.net



> _______________________________________________
> vile mailing list
> address@hidden
> https://lists.nongnu.org/mailman/listinfo/vile




reply via email to

[Prev in Thread] Current Thread [Next in Thread]