[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Issue with wbkgrnd and wide chars on ncurses 6.2
From: |
Thomas Dickey |
Subject: |
Re: Issue with wbkgrnd and wide chars on ncurses 6.2 |
Date: |
Sat, 30 Jan 2021 15:30:07 -0500 |
User-agent: |
Mutt/1.10.1 (2018-07-13) |
On Sat, Jan 30, 2021 at 08:21:26PM +0100, Anton Vidovic wrote:
> Hello Thomas,
>
> I contacted you last April [0] about a bug I encountered while working on
> a Common Lisp binding for ncurses.
thanks (I didn't forget this - it was one of two regressions that I'd
like to repair before ncurses 6.3)
> As far as I could, I tracked down the source of the bug to the following
> line 209 in ncurses/base/lib_bkgd.c
offhand, I'd have thought this was the issue (given the comments),
/* SVr4 limits background character to printable 7-bits */
if (!Charable(new_bkgd)) {
new_char = old_char;
}
>
> for (y = 0; y <= win->_maxy; y++) {
> int x;
> for (x = 0; x <= win->_maxx; x++) {
> NCURSES_CH_T *cp = &(win->_line[y].text[x]);
> int tmp_pair = GetPair(*cp);
> attr_t tmp_attr = AttrOf(*cp);
>
> if (CharEq(*cp, old_bkgd)) {
> >>>> SetChar2(*cp, CharOf(new_char)); <<<<<<<
> }
>
> In ncurses 6.1, instead of the call to SetChar2, we directly set the
> character at y,x to the character set by the call to wbkgrndset.
>
> win->_line[y].text[x] = win->_nc_bkgd;
>
> In addition to the minimal example in Lisp [2] I provided last year,
> this would be equivalent minimal example in C:
>
> #define _XOPEN_SOURCE_EXTENDED
> #include <locale.h>
> #include <ncurses.h>
>
> int main()
> {
> cchar_t cch;
> const wchar_t wch[2] = {L'\u2591', L'\0'};
>
> setlocale(LC_ALL, "");
> setcchar(&cch,
> wch,
> 0,
> 0,
> NULL);
>
> initscr();
> bkgrnd(&cch);
> refresh();
> getch();
> endwin();
> printf("%lc\n", wch[0]);
> return 0;
> }
>
> This allows setting single-byte chars like 'A' as a background char,
> but if any wide char like L'\u2591' is passed, it is simply ignored.
>
> Last year I did not have success replicating the bug in C, but in the
> meantime I have upgraded my machine, and now with a fresh install of
> Ubuntu 20.04 with a default install of ncurses 6.2.20200212, the C
> example replicates the behavior I encountered with Lisp.
>
> I hope you will find an opportunity to address this issue.
I guess this (barring build-problems...) is next on my to-do list
--
Thomas E. Dickey <dickey@invisible-island.net>
https://invisible-island.net
ftp://ftp.invisible-island.net
signature.asc
Description: PGP signature