[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bug-ncurses] ANN: ncurses-6.4-20240120
From: |
Thomas Dickey |
Subject: |
Re: [bug-ncurses] ANN: ncurses-6.4-20240120 |
Date: |
Mon, 22 Jan 2024 20:23:11 -0500 |
On Mon, Jan 22, 2024 at 10:30:47AM +0100, Dr. Werner Fink wrote:
> On 2024/01/22 04:15:39 -0500, Thomas Dickey wrote:
> > On Mon, Jan 22, 2024 at 09:12:31AM +0100, Dr. Werner Fink wrote:
> > > On 2024/01/20 23:32:02 +0000, Thomas Dickey wrote:
> > > > misc/terminfo.src | 1440 +++++------
> > >
> > > > 20240120
> > > > + use ansi+sgrbold, ansi+sgrdim, ansi+sgrso, ansi+sgrul,
> > > > ansi+tabs
> > > > ecma+color, ecma+sgr, vt100+4bsd, vt100+pfkeys, vt220+pcedit
> > > > xterm+256color, xterm+acs, xterm+nopcfkeys, xterm+pcf2 to
> > > > trim -TD
> > >
> > > Simple question on (u)rxvt (with TERM=rxvt-unicode): in rxvt-basic the
> > > arrow
> > > keys are given as
> > >
> > > kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A,
> > >
> > > this agrees with the result on the shell command line
> > >
> > > ^[[D^[[A^[[B^[[C
> > >
> > > but not within an application like vim
> > >
> > > ^[OD^[OA^[OB^[OC
> >
> > perhaps this -
> >
> > vim uses smkx/rmkx,
> >
> > rmkx=\E>,
> > smkx=\E=,
> >
>
> Also less does this :)
> An strace log ( strace -s 1024 -e write -o log vim)
> shows:
>
> grep -E '\\33(=|>)' log
> write(1, "\33[?1049h\33[?1h\33=\33[?2004h\33[?1004h", 31) = 31
> write(1, "\33[24;1H\33[K\33[24;1H\33[?1004l\33[?2004l\33[?1l\33>", 40) = 40
>
>
> > but not is1/rs1
> >
> > infocmp rxvt-basic rxvt-unicode
> > is1: '\E[?47l\E=\E[?1l', '\E[!p'.
> > rs1: '\E>\E[1;3;4;5;6l\E[?7h\E[m\E[r\E[2J\E[H', '\Ec'.
> >
> > but \E= sets application mode
> >
> > ESC = Application Keypad (DECKPAM).
> > ESC > Normal Keypad (DECKPNM), VT100.
>
> infocmp rxvt-basic rxvt-unicode | grep -E '(s1|kx):'
> is1: '\E[?47l\E=\E[?1l', '\E[!p'.
> rmkx: '\E>', '\E[?1l\E>'.
> rs1: '\E>\E[1;3;4;5;6l\E[?7h\E[m\E[r\E[2J\E[H', '\Ec'.
> smkx: '\E=', '\E[?1h\E='.
I checked on the command-line using "tput smkx" and before/after, used
"cat -v" (with ^V to make the escape character literal) and see urxvt
using only the normal cursor keys (\E[ rather than the application \EO).
Using strace, I can see that "less" is only getting the normal cursor keys.
71502 19:47:50 read(3, "\33", 1) = 1
71502 19:47:52 read(3, "[", 1) = 1
71502 19:47:52 read(3, "B", 1) = 1
71502 19:47:52 read(3, "\33", 1) = 1
71502 19:47:52 read(3, "[", 1) = 1
71502 19:47:52 read(3, "B", 1) = 1
71502 19:47:52 read(3, "\33", 1) = 1
71502 19:47:53 read(3, "[", 1) = 1
71502 19:47:53 read(3, "C", 1) = 1
71502 19:47:53 read(3, "\33", 1) = 1
But vim is different. strace shows that it is reading application mode.
71555 19:48:41 read(0, "\26", 4096) = 1
71555 19:48:42 read(0, "\33OA", 4096) = 3
71555 19:48:46 read(0, "\33", 4096) = 1
71555 19:48:48 read(0, "o", 4096) = 1
71555 19:48:49 read(0, "\26", 4096) = 1
71555 19:48:50 read(0, "\33OD", 4096) = 3
71555 19:48:52 read(0, "\r", 4096) = 1
71555 19:48:53 read(0, "\26", 4096) = 1
71555 19:48:53 read(0, "\33OC", 4096) = 3
71555 19:48:54 read(0, "\33", 4096) = 1
strace shows vim initializing the terminal:
71555 19:48:35 write(1,
"\33[?1049h\33[>4;2m\33[?1h\33=\33[?2004h\33[?1004h", 38) = 38
or more readable (unmap):
\E[?1000h
\E[?1049h
\E[>4;2m
\E[?1h
\E=
\E[?2004h
\E[?1004h
\E[1;24r
\E[?12h
\E[?12l
\E[22;2t
\E[22;1t
\E[27m
\E[23m
\E[29m
\E[m
\E[H
\E[2J
but little of that (perhaps none) comes from the terminfo.
In particular,
\E[?1h
which (xterm control sequences) shows where the application mode is set
and reset:
CSI ? Pm h
DEC Private Mode Set (DECSET).
Ps = 1 -> Application Cursor Keys (DECCKM), VT100.
CSI ? Pm l
DEC Private Mode Reset (DECRST).
Ps = 1 -> Normal Cursor Keys (DECCKM), VT100.
Of course, rxvt/urxvt have some differences from xterm, but this happens
to work in vim because these particular VT100-sequences are implemented.
vim's using its compiled-in list of escape sequences:
/*
* Builtin xterm with Vim-specific entries.
*/
static tcap_entry_T builtin_xterm[] = {
in src/term.c, e.g.,
{(int)KS_KS, "\033[?1h\033="},
{(int)KS_KE, "\033[?1l\033>"},
--
Thomas E. Dickey <dickey@invisible-island.net>
https://invisible-island.net
signature.asc
Description: PGP signature
- ANN: ncurses-6.4-20240120, Thomas Dickey, 2024/01/20
- Re: ANN: ncurses-6.4-20240120, Sven Joachim, 2024/01/21
- Re: [bug-ncurses] ANN: ncurses-6.4-20240120, Dr. Werner Fink, 2024/01/22
- Re: [bug-ncurses] ANN: ncurses-6.4-20240120, Thomas Dickey, 2024/01/22
- Re: [bug-ncurses] ANN: ncurses-6.4-20240120, Dr. Werner Fink, 2024/01/22
- Re: [bug-ncurses] ANN: ncurses-6.4-20240120,
Thomas Dickey <=
- Re: [bug-ncurses] ANN: ncurses-6.4-20240120, Dr. Werner Fink, 2024/01/23
- Re: [bug-ncurses] ANN: ncurses-6.4-20240120, Thomas Dickey, 2024/01/23
- Re: [bug-ncurses] ANN: ncurses-6.4-20240120, Thomas Dickey, 2024/01/27
- Re: [bug-ncurses] ANN: ncurses-6.4-20240120, Dr. Werner Fink, 2024/01/29