bug-ncurses
[Top][All Lists]
Advanced

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

Re: -2 in numeric and string capabilities


From: Thomas Dickey
Subject: Re: -2 in numeric and string capabilities
Date: Tue, 21 Jul 2020 04:05:30 -0400
User-agent: NeoMutt/20170113 (1.7.2)

On Tue, Jul 21, 2020 at 07:11:10AM +0200, Florian Weimer wrote:
> * Thomas Dickey:
> 
> > On Mon, Jul 20, 2020 at 08:54:00PM +0200, Florian Weimer wrote:
> >> term(5) says this:
> >> 
> >> | Short integers are stored in two 8-bit bytes.  The first byte contains
> >> | the least significant 8 bits of the value, and the second byte
> >> | contains the most significant 8 bits.  (Thus, the value represented is
> >> | 256*second+first.)  The value -1 is represented by the two bytes 0377,
> >> | 0377; other negative values are illegal. […]
> >> |
> >> | The numbers section is similar to the flags section.  Each capability
> >> | takes up two bytes, and is stored as a little-endian short integer.
> >> | If the value represented is -1, the capability is taken to be
> >> | missing.
> >> |
> >> | The strings section is also similar.  Each capability is stored as a
> >> | short integer, in the format above.  A value of -1 means the
> >> | capability is missing.  Otherwise, the value is taken as an offset
> >> | from the beginning of the string table. […]
> >> 
> >> But the value -2 occurs in practice, too.
> >
> > in a terminal description?
> 
> It does.
> 
> > perhaps not - tic won't accept a negative value.
> > ...if it did, that would be a bug
> > ...of course, someone could put the bits together without the tool :-)

I couldn't recall, last night, so I constructed an example by

        infocmp -1 screen | sed -e 's/colors#/colors#-1/' >foo
        tic -c foo
 
and got this:

"foo", line 8, col 16, terminal 'screen': no value given for `colors'
"foo", line 8, col 16, terminal 'screen': Missing separator
"foo", line 8, col 19, terminal 'screen': unknown capability '18'

where line 18 is

        colors#-8,

So I commented that tic won't accept a negative value.
(It makes its own, internally, of course).

> I see it in Debian's ncurses-term package (version
> 6.1+20181013-2+deb10u2).  It occurs for the numeric capability 15
> (no_color_video, I think) in the xterm-xf86-v32 terminal description,

You're referring to a cancelled capability, which infocmp shows as

        ncv@,

> or for the string capability 52 (insert_character) in the xterm-nic

strings are a different matter

> terminal description file.  I see similar problems in Fedora's Eterm
> description file (package version ncurses-base-6.1-15.20191109.fc32),
> so it's not caused by a Debian-specific patch.
> 
> I haven't checked whether this still happens with current upstream
> sources.
> 
> I think canceled capabilities need to be flagged in the compiled
> description file somehow (and differently from absent capabilities) if
> terminal descriptions are to be compiled separately.

cancelled capabilities are indicated in the terminfo source by a "@"

That's mentioned in a few places in infocmp(1) and terminfo(5).

Based on your comments, I had in mind tying those together in this
thread by including the handling of cancelled capabilities in tput(1),
relating them to term(5).

-- 
Thomas E. Dickey <dickey@invisible-island.net>
https://invisible-island.net
ftp://ftp.invisible-island.net

Attachment: signature.asc
Description: PGP signature


reply via email to

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