|Subject:||Re: mvwchgat breaks ACS chars|
|Date:||Sun, 15 Jul 2018 10:57:40 +0200|
On Fri, Jul 13, 2018 at 12:17:50PM +0200, Pavel Stehule wrote:
> I am working on library https://github.com/okbob/
ncurses-st-menu, where I
> try to implement shadow under a window. I use mvwchgat function for colour
> changes. Yesterday I found a issue. This function doesn't works with chars
> passed by ACS_xx macros. The unicode chars has not this problem.
> When I apply mvwchgat on hline, then result is 'x' char.
That's the expected behavior. The ACS_xxx mapping is done at the time
the characters are rendered. Otherwise, for instance, you couldn't
use the Unicode values indirectly via the chtype values. That was
part of why I settled on this behavior in 2002;
+ rewrote lib_acs.c to allow PutAttrChar() to decide how to render
alternate-characters, i.e., to work with Linux console and UTF-8
(There was also some scenario where the ACS_xxx flags would be applied
more than once in the original scheme, causing incorrect output, which
the rewrite addressed).
> I wrote test case - see a attachment, please.
> I have ncurses 6.1 patch patch: 20180224
> Is it bug? Is there some alternative solution, how to change colours and
> attributes on specified positions?
You can always read the current attributes for a given position
using win_wchstr(), etc., along with getcchar(). With the current
information, you can modify the cells...
X/Open Curses isn't sufficiently detailed to provide guidance.
In a quick check, Solaris xcurses is too broken to run the test-case
(though reading the source for Illumos suggests that it makes no special
provision to leave ACS_xxx alone), testing with HPUX and AIX curses
leaves the vertical line alone, but does not make the cell bold, either.
Not that it matters, but NetBSD curses treats the ACS_VLINE the same way
as ncurses. (I'd comment on PDCurses as well, but its X11 port's been
broken for quite a while).
> Best regards
> Pavel Stehule
> #include <ncurses.h>
> * Application demo
> keypad(stdscr, TRUE);
> init_pair(1, COLOR_WHITE, COLOR_BLUE);
> init_pair(2, COLOR_WHITE, COLOR_BLACK);
> wbkgd(stdscr, COLOR_PAIR(1));
> wmove(stdscr, 5, 5);
> waddstr(stdscr, "@");
> wmove(stdscr, 5, 10);
> waddch(stdscr, ACS_VLINE);
> mvwprintw(stdscr, 10, 5, "correct output (before mvwchgat)");
> mvwprintw(stdscr, 11, 5, "press any key");
> mvwchgat(stdscr, 5, 5, 1, A_BOLD, 2, NULL);
With Solaris xcurses, that should be WA_BOLD.
The other implementations equate the two sets of names.
> mvwprintw(stdscr, 10, 5, "still correct output (before mvwchgat on hline)");
> mvwprintw(stdscr, 11, 5, "press any key, ");
> mvwchgat(stdscr, 5, 10, 1, A_BOLD, 2, NULL);
> mvwprintw(stdscr, 10, 5, "hline is broken now");
> mvwprintw(stdscr, 11, 5, "press any key, .. will quit ");
> return 0;
Thomas E. Dickey <address@hidden>
|[Prev in Thread]||Current Thread||[Next in Thread]|