bug-ncurses
[Top][All Lists]
Advanced

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

Re: ACS and repeating characters


From: Dick Wesseling
Subject: Re: ACS and repeating characters
Date: Tue, 25 Jul 2017 00:51:02 +0200

On Sat, Jul 15, 2017 at 08:44:07PM -0400, Thomas Dickey wrote:
> > On Fri, Jul 14, 2017 at 03:17:58AM +0200, Dick Wesseling wrote:
> > >
> > > When emitting a range of repeated characters from the Alternate
> > > Characer Set, EmitRange() supplies CharOf(ntext0) as the first parameter
> > > of 'repeat_char' without translation. For example, ACS_HLINE is
> > > printed as 'q' instead of \304.
> > >
> > > This can be reproduced with "TERM=ansi ./demo_forms".
> >
> > I see (by running this in Linux console, disabling UTF-8 and using
> > the ncurses test-program menu f or F, if the number of graphic characters
> > in a row is more than 4-5, the first character becomes "q", etc).
> >
> > The test wouldn't work for xterm :-)
>
> I took a close look today, and see that it is not a bug in ncurses.

Look again. Even better, look twice: once with the attached patch
applied and once with an unpatched version.

> Linux console does not implement the "rep" (repeat) control found in
> the "ansi" terminal description.

If testing with linux console and TERM=ansi instead of an ansi terminal
you should still get (a single) 'q' instead of \304 without the patch.

*** ncurses-5.9/ncurses/tty/tty_update.c~       Sun Dec 19 02:21:02 2010
--- ncurses-5.9/ncurses/tty/tty_update.c        Tue Jul 25 00:17:26 2017
***************
*** 585,597 ****

                if (wrap_possible)
                    rep_count--;

                UpdateAttrs(SP_PARM, ntext0);
                NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx
                                        TPARM_2(repeat_char,
!                                               CharOf(ntext0),
                                                rep_count),
                                        rep_count,
                                        NCURSES_SP_NAME(_nc_outch));
                SP_PARM->_curscol += rep_count;

--- 585,603 ----

                if (wrap_possible)
                    rep_count--;

                UpdateAttrs(SP_PARM, ntext0);
+               NCURSES_CH_T temp = ntext0;
+               if ((AttrOf(temp) & A_ALTCHARSET) &&
+                       (CharOfD(temp) < ACS_LEN) &&
+                       SP_PARM->_acs_map != 0) {
+                       temp = SP_PARM->_acs_map[CharOfD(temp)];
+               }
                NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx
                                        TPARM_2(repeat_char,
!                                               CharOf(temp),
                                                rep_count),
                                        rep_count,
                                        NCURSES_SP_NAME(_nc_outch));
                SP_PARM->_curscol += rep_count;



reply via email to

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