diff options
Diffstat (limited to 'contrib/ncurses/ncurses/widechar/lib_inwstr.c')
-rw-r--r-- | contrib/ncurses/ncurses/widechar/lib_inwstr.c | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/contrib/ncurses/ncurses/widechar/lib_inwstr.c b/contrib/ncurses/ncurses/widechar/lib_inwstr.c index c3c46fa..2207a5f 100644 --- a/contrib/ncurses/ncurses/widechar/lib_inwstr.c +++ b/contrib/ncurses/ncurses/widechar/lib_inwstr.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 2002 Free Software Foundation, Inc. * + * Copyright (c) 2002,2004 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -27,7 +27,7 @@ ****************************************************************************/ /**************************************************************************** - * Author: Thomas Dickey 2002 * + * Author: Thomas Dickey * ****************************************************************************/ /* @@ -39,10 +39,10 @@ #include <curses.priv.h> -MODULE_ID("$Id: lib_inwstr.c,v 1.1 2002/03/10 00:25:27 tom Exp $") +MODULE_ID("$Id: lib_inwstr.c,v 1.4 2004/10/23 20:41:28 tom Exp $") NCURSES_EXPORT(int) -winnwstr(WINDOW *win, wchar_t * wstr, int n) +winnwstr(WINDOW *win, wchar_t *wstr, int n) { int row, col, inx; int count = 0; @@ -50,23 +50,25 @@ winnwstr(WINDOW *win, wchar_t * wstr, int n) cchar_t *text; wchar_t wch; - TR(TRACE_CCALLS, (T_CALLED("winnwstr(%p,%p,%d)"), win, wstr, n)); + T((T_CALLED("winnwstr(%p,%p,%d)"), win, wstr, n)); if (wstr != 0) { if (win) { getyx(win, row, col); text = win->_line[row].text; while (count < n && count != ERR) { - for (inx = 0; (inx < CCHARW_MAX) - && ((wch = text[col].chars[inx]) != 0); - ++inx) { - if (count + 1 >= n) { - if ((count = last) == 0) { - count = ERR; /* error if we t store nothing */ + if (!isWidecExt(text[col])) { + for (inx = 0; (inx < CCHARW_MAX) + && ((wch = text[col].chars[inx]) != 0); + ++inx) { + if (count + 1 > n) { + if ((count = last) == 0) { + count = ERR; /* error if we store nothing */ + } + break; } - break; + wstr[count++] = wch; } - wstr[count++] = wch; } last = count; if (++col > win->_maxx) { @@ -74,8 +76,10 @@ winnwstr(WINDOW *win, wchar_t * wstr, int n) } } } - if (count > 0) + if (count > 0) { wstr[count] = '\0'; + T(("winnwstr returns %s", _nc_viswbuf(wstr))); + } } returnCode(count); } @@ -86,10 +90,10 @@ winnwstr(WINDOW *win, wchar_t * wstr, int n) * it does not define what happens for a negative count with winnwstr(). */ NCURSES_EXPORT(int) -winwstr(WINDOW *win, wchar_t * wstr) +winwstr(WINDOW *win, wchar_t *wstr) { int result = OK; - TR(TRACE_CCALLS, (T_CALLED("winwstr(%p,%p)"), win, wstr)); + T((T_CALLED("winwstr(%p,%p)"), win, wstr)); if (winnwstr(win, wstr, CCHARW_MAX * (win->_maxx - win->_curx + 1)) == ERR) result = ERR; returnCode(result); |