bug-ncurses
[Top][All Lists]
Advanced

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

Re: wchgat strips A_ALTCHARSET attrib; should it?


From: Thomas Dickey
Subject: Re: wchgat strips A_ALTCHARSET attrib; should it?
Date: Sat, 14 Nov 2020 18:28:13 -0500
User-agent: NeoMutt/20170113 (1.7.2)

On Sat, Nov 07, 2020 at 03:22:52PM -0500, Thomas Dickey wrote:
> On Fri, Nov 06, 2020 at 07:24:12PM -0600, Bryan Christ wrote:
> > It's been this way for a long time.  I've worked around it by checking for
> > the flag, saving it, and then adding it back after the call.
> 
> There's nothing explicit in X/Open which would require that the alternate
> character set be trimmed:
> 
> https://pubs.opengroup.org/onlinepubs/7908799/xcurses/chgat.html
> 
> however, following a few links takes me here:
> 
> https://pubs.opengroup.org/onlinepubs/7908799/xcurses/attroff.html
> 
>       It is unspecified whether these functions can be used to manipulate
>       attributes other than A_BLINK, A_BOLD, A_DIM, A_REVERSE, A_STANDOUT and
>       A_UNDERLINE. 
> 
> which I seem to recall having read at some point.
> 
> > On Fri, Nov 6, 2020, 19:00 Bill Gray <pluto@projectpluto.com> wrote:
> > 
> > >     This "bug" (if it is one) cropped up in PDCursesMod,
> > > which provides screen shots that should make the sort of
> > > misbehavior obvious :
> > >
> > > https://github.com/Bill-Gray/PDCursesMod/issues/192
> > >
> > >     The same thing happens in ncurses.  As you can see in the
> > > discussion at the above link,  we're unclear if this is the
> > > specified behavior,  or if it's a for-real bug.  It is
> > > certainly undesirable behavior,  but I don't want to "fix"
> > > it in PDCursesMod if it's supposed to do that.
> > >
> > >     I've posted a minimal example showing the bug at
> > >
> > > https://www.projectpluto.com/temp/box.c
> > >
> > >     Any opinion?
> 
> fwiw, Solaris xpg4 (X/Open) curses behaves the same as ncurses in this case.

If it were done differently in SVr4 curses,
there'd be good reason to change ncurses.

However, chgat wasn't in SVr4 curses, but predates X/Open Curses.
I see it mentioned in this 1987 AIX 2.1.1 manual:

http://www.bitsavers.org/pdf/ibm/pc/rt/aix/SC23-0808-0_AIX_2.1.1_Technical_Reference_Volume_1_Jun87.pdf

and 1991 update:

http://ps-2.kev009.com/aixps2/boo2pdf/SC23-2300-01_AIX_PS2_and_System370_Technical_Reference_Mar_1991.pdf

Besides chgat, some other functions use or manipulate the A_xxx bits.
In older documentation, it's taken for granted that vidputs and vidattr
can send any combination of those bits.

In ncurses, the relevant manipulation is done internally using
the SetAttr macro.  Just changing the macro would probably break
something, and special-casing chgat doesn't seem productive either:

base/lib_addch.c:69:    SetAttr(ch, a | AttrOf(win->_nc_bkgd));
base/lib_bkgd.c:151:        SetAttr(tmp_bkgd, AttrOf(new_bkgd));
base/lib_bkgd.c:213:                    SetAttr(*cp, (tmp_attr & ~old_attr) | 
new_attr);
base/lib_bkgd.c:216:                    SetAttr(*cp,
base/lib_bkgd.c:221:                SetAttr(*cp, (tmp_attr & ~old_attr) | 
new_attr);
base/lib_chgat.c:72:        SetAttr(line->text[i], attr);
base/lib_overlay.c:197:                         SetAttr(dst->_line[dy].text[dx],
base/lib_slk.c:172:     SetAttr(SP_PARM->_slk->attr, A_STANDOUT);
base/lib_slk.c:174:     SetAttr(SP_PARM->_slk->attr, A_REVERSE);
base/lib_slkatr_set.c:64:       SetAttr(SP_PARM->_slk->attr, attr);
base/lib_slkatrset.c:50:        SetAttr(SP_PARM->_slk->attr, attr);
tty/lib_vidattr.c:338:  SetAttr(SCREEN_ATTRS(SP_PARM), newmode);
tty/tty_update.c:2148:    SetAttr(SCREEN_ATTRS(SP_PARM), A_NORMAL);
widechar/lib_add_wch.c:73:      SetAttr(ch, a | AttrOf(win->_nc_bkgd));
widechar/lib_cchar.c:88:            SetAttr(*wcval, attrs);
widechar/lib_vid_attr.c:273:    SetAttr(SCREEN_ATTRS(SP_PARM), newmode);

> To test that, I replaced the getch loop on KEY_RESIZE with just getch,
> and set TERM=vt100 -- attached
> 
> AIX and HPUX generally behave the same as the xpg4 curses.

however, not in this case (tested today).  I recall that HPUX doesn't
implement (some) of the alternate-characters in an mapping array as done in
other implementations.  Setting/clearing A_ALTCHARSET would mean that
non-array implementation wouldn't work well - so X/Open Curses makes it
unspecified.

-- 
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]