[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: in_wch and add_wch
From: |
Thomas Dickey |
Subject: |
Re: in_wch and add_wch |
Date: |
Sat, 2 Sep 2006 20:46:30 -0400 (EDT) |
On Sat, 2 Sep 2006, Sadrul H Chowdhury wrote:
Hi.
I am trying to in_wch a wide-character (cchar_t), change the attribute and
add_wch that to the screen again in the same position. But I am not sure
what I am doing wrong, because it's not behaving properly.
at the moment, I don't see either. I built it with a debugging version of
ncurses, so I could trace it. I see this chunk:
called {win_wch(stdscr,0xbf97a69c)
return }0
called {wmove(stdscr,1,1)
return }0
called {wadd_wch(stdscr, {{ 0344, 0270, 0212 } | {A_CHARTEXT|A_NORMAL}})
+ called {waddch(stdscr, {0345})
render_char bkg {{ ' ' = 040 }} (0), attrs {A_NORMAL} (0) -> ch {{ 0303, 0245
}} (0)
+ return }0
+ called {waddch(stdscr, {0271})
render_char bkg {{ ' ' = 040 }} (0), attrs {A_NORMAL} (0) -> ch {{ 0302, 0271
}} (0)
+ return }0
+ called {waddch(stdscr, {0213})
render_char bkg {{ ' ' = 040 }} (0), attrs {A_NORMAL} (0) -> ch {{ 0302, 0213
}} (0)
multicolumn 1:2 (1,1)
multicolumn 2:2 (1,2)
cell (1, 1..2) = {{ 0345, 0271, 0213 }}
+ return }0
return }0
and checking the original value written to the 0,0 position, it matches
the parameter given to wadd_wch(). The trace of the corresponding
waddch's does not look right - perhaps you've found a bug (will check).
I have included a sample program which printw()s some multi-column
characters (the meaning of which I don't know, btw), in_wch one of them, and
add_wch that without changing anything in a different screen position. The
output of printw is correct, but the output of add_wch is different
(incorrect). The code is below:
/*** START ***/
#define _XOPEN_SOURCE_EXTENDED
#include <ncursesw/ncurses.h>
#include <locale.h>
int main()
{
cchar_t ch;
setlocale(LC_ALL, "");
initscr();
mvprintw(0, 0, "%s", "\u4e0a\u6d77\u6700\u4f4e\u6708\u5de5");
if (mvin_wch(0, 0, &ch) == OK)
mvadd_wch(1, 1, &ch);
getch();
endwin();
return 0;
}
/*** END ***/
I also tried the wchgat family of functions, without much success. Anyone
can please tell me what I am doing wrong?
Thanks,
Sadrul
--
Thomas E. Dickey
http://invisible-island.net
ftp://invisible-island.net
- in_wch and add_wch, Sadrul H Chowdhury, 2006/09/02
- Re: in_wch and add_wch,
Thomas Dickey <=