bug-ncurses
[Top][All Lists]
Advanced

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

Re: wadd_wch() operates on wrong coords for non-spacing chars


From: Thomas Dickey
Subject: Re: wadd_wch() operates on wrong coords for non-spacing chars
Date: Sun, 9 Jul 2023 13:56:32 -0400

On Thu, Jul 06, 2023 at 04:14:12AM -0400, Thomas Dickey wrote:
> On Wed, Jul 05, 2023 at 10:21:55PM -0400, Bill Gray wrote:
> > On 7/5/23 19:41, Thomas Dickey wrote:
> > > On Wed, Jul 05, 2023 at 09:51:32PM +0200, Roman Zilka wrote:
> > > > Hello,
> > > > 
> > > > according to curs_add_wch(3x) add_wch() adds non-spacing characters to
> > > > the base character on the current coordinates. Therefore, the
> > > > following program should print "aáa". It prints "áaa", however.
> > > 
> > > thanks - I can reproduce this, will investigate
> > 
> >    More simply,  addwstr( L"a\u0301aa");  will emit áaa,  not aáa.  So does
> 
> I read the example as
>       addwstr( L"aa\u0301a");  
> 
> and did not recall whether add_wch called addch (checking the source, I see
> that it updates the cells directly).  If it did that, then the move()
> calls could interfere with the process (see man addch).
> 
> But the move() calls are probably relevant - something to see on Saturday.

...still on my to-do list actually (what I did took all day)

Aside from responding here, most of today's going to xterm...
 
> > wprintf( "La\u0301aa").  I noticed this some years back and assumed it was
> > supposed to be that way:  the combining character modifies the preceding
> > character.  A bit of Web searching suggests that's the way it's supposed to
> > work;  to get á,  you emit a and then \u0301,  not \u0301 and then a.
> > 
> >    Seen from that angle,  Roman's program is working correctly;
> > 
> >     move(0, 1); add_wch(&ccmod);
> > 
> >    says "add an accent to the character just to the left of (0, 1)."
> > However,  I have to admit that the man page description,  I think, supports
> > Roman's expected behavior.

I think we're talking about this paragraph:

       •   If  wch  refers to a non-spacing character, all previous characters
           at that location are preserved.  The non-spacing characters of  wch
           are added to the spacing complex character, and the rendition spec‐
           ified by wch is ignored.

After the first add_wch, the current position is _after_ that character,
but the position for the purpose of combining is _that_ character.
So... a move to the cell after the spacing character can combine with it.

At least, that's how I'm reading it today.  An example in the manpage would
probably help a lot :-)

> >    I would find it annoying to use \u0301aaa for curses and a\u0301aa for
> > everything else.
> > 
> >    Are there any implementations of curses other than ncurses and
> > PDCursesMod that handle combining characters?  (I copied the ncurses
> > behavior for PDCursesMod,  so that's not independent support for the ncurses
> > behavior.)
> 
> Solaris' X/Open curses might - I can check that.
> I seem to recall that NetBSD doesn't - but can check that.

...in a quick check, Solaris 10's X/Open curses and ncurses match.
I went a little further with the testcase (attached) to separate it from the
possibility that the left-margin of the window might be related.

NetBSD doesn't support this feature (looks like the cell with the
combining character is omitted).

Looking at Bill's widetest.c, Solaris does not show the accents on the
second line of the display (which the comment says are intended to
test combining characters).  To compile that, I ifdef'd the chunks that
use KEY_RESIZE.

NetBSD's output here isn't an improvement (the cells of interest are
all missing-character symbols).

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

Attachment: foo.c
Description: Text Data

Attachment: signature.asc
Description: PGP signature


reply via email to

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