On Fri, Dec 19, 2025 at 12:12:21AM +0100, Dirk Gouders wrote:
> Thomas Dickey <[email protected]> writes:
> 
> > On Thu, Dec 18, 2025 at 09:38:06AM -0600, G. Branden Robinson wrote:
> >> At 2025-12-18T12:41:02+0100, Dirk Gouders wrote:
> >> > Thomas Dickey <[email protected]> writes:
> >> > > ncurses 6.5 does have a use for u6 and u7, but only in a special
> >> > > case where it matches common variants of that particular string:
> >> > >
> >> > > 20231001
> >> > >        + modify setupterm to provide for using ANSI cursor-position
> >> > >          report (in user6/user7 terminfo capabilities) to obtain
> >> > >          screensize if neither environment variables or ioctl is used.
> >> > >          The ncurses test-program with options "-E -T" demonstrates
> >> > >          this feature.
> >> > 
> >> > Thank you for that hint, in ncurses/tinfo/lib_setup.c I found some
> >> > code that I am now trying to understand and maybe I find other
> >> > locations (I didn't grep for "user6" before your answer, but only "u6"
> >> > and "%dR".).

perhaps my earlier response helped to clarify it.  I used matches against
the strings used in the terminal database rather than writing a decompiler
or analyzer because there's very little variation (aside from terminals
that I've not seen for more than 20 years).

In tack, I spent some time to make it handle regex-like patterns so that it
could match responses from the terminal.  Here are query/response capabilities
from the xterm terminal description:

        RV=\E[>c,
        XM=\E[?1006;1000%?%p1%{1}%=%th%el%;,
        XR=\E[>0q,

        rv=\E\\[>41;[1-6][0-9][0-9];0c,
        xm=\E[<%i%p3%d;%p1%d;%p2%d;%?%p4%tM%em%;,
        xr=\EP>\\|XTerm\\(([1-9][0-9]+)\\)\E\\\\,

I made similar ones for the other terminal emulators that I can test.

tack can deal with XR/xr and RV/rv, but not XM/xm.

When I added XM, I had in mind doing something like that, but haven't
found it necessary.  The u6-u9 string capabilities are similar, and
could in principle have been interpreted.

As I mentioned, tack deals with u8/u9.  I suppose that adding tests
for u6/u7 would be useful, as well.  Note that both u6 and xm use %i.

        u6=\E[%i%d;%dR,
        u7=\E[6n,
        u8=\E[?%[;0123456789]c,
        u9=\E[c,

> > References to the standard capability names in the source code usually use
> > the long name, because that happens to be defined in term.h for the terminal
> > definition which is currently loaded in memory.
> >
> > man terminfo has this list:
> >
> >        user0                      u0        u0  User string #0
> >        user1                      u1        u1  User string #1
> >        user2                      u2        u2  User string #2
> >        user3                      u3        u3  User string #3
> >        user4                      u4        u4  User string #4
> >        user5                      u5        u5  User string #5
> >        user6                      u6        u6  User string #6
> >        user7                      u7        u7  User string #7
> >        user8                      u8        u8  User string #8
> >        user9                      u9        u9  User string #9
> >
> > I suppose Raymond or Weaver chose user6-user9 to be less intrusive,
> > leaving user0-user5 for actual user-defined stuff.
> 
> Thank you for the explanation.

no problem
 
> >> > The above text says "The ncurses test-program".  Which program is
> >> > meant by this?
> >> 
> >> I suspect he means the program named "ncurses" that appears in the
> >> "test" directory of an ncurses build.
> >
> > right.
> > That's how it's been referred to for about 30 years.
> >
> > 961019      - snapshot
> >     + correct loop-limit in wnoutrefresh(), bug exposed during pipe-testing
> >       had '.lastchar' entry one beyond '._maxx'.
> >     + modify ncurses test-program to work with data piped to it.
> >
> > But (looking at the NEWS file) I more often just say "test/ncurses".
> 
> Could be that was just a non-native speaker problem, thank you for the
> clarification.  I perhaps should not have been focussed on terminfo
> (e.g. demo_terminfo) but should have taken the time to first get an
> overview. Then, a test-program ncurses, named exactly as the library,
> would certainly have attracted my attention.

I seem to recall that I picked up the phrasing "ncurses test program"
from Eric Raymond.  There were 15 programs in the test-directory at
that point, but it was the largest and most oriented toward testing.
The others are interesting demos.  There are 90 now...
 
> Regards,
> 
> Dirk



-- 
Thomas E. Dickey <[email protected]>
https://invisible-island.net

Attachment: signature.asc
Description: PGP signature

Reply via email to