1
1
/****************************************************************************
2
* Copyright (c) 1998-2005,2006 Free Software Foundation, Inc. *
2
* Copyright (c) 1998-2006,2008 Free Software Foundation, Inc. *
4
4
* Permission is hereby granted, free of charge, to any person obtaining a *
5
5
* copy of this software and associated documentation files (the *
210
210
WINDOW_EXT(win, addch_y) = y;
213
buffer[WINDOW_EXT(win, addch_used)] = CharOf(CHDEREF(ch));
213
buffer[WINDOW_EXT(win, addch_used)] = (char) CharOf(CHDEREF(ch));
214
214
WINDOW_EXT(win, addch_used) += 1;
215
215
buffer[WINDOW_EXT(win, addch_used)] = '\0';
216
216
if ((len = mbrtowc(&result,
218
218
WINDOW_EXT(win, addch_used), &state)) > 0) {
219
219
attr_t attrs = AttrOf(CHDEREF(ch));
220
if_EXT_COLORS(int pair = GetPair(CHDEREF(ch)));
220
221
SetChar(CHDEREF(ch), result, attrs);
221
WINDOW_EXT(win, addch_used) = 0;
225
* An error occurred. We could either discard everything,
226
* or assume that the error was in the previous input.
229
TR(TRACE_VIRTPUT, ("Alert! mbrtowc returns error"));
230
buffer[0] = CharOf(CHDEREF(ch));
231
WINDOW_EXT(win, addch_used) = 1;
222
if_EXT_COLORS(SetPair(CHDEREF(ch), pair));
223
WINDOW_EXT(win, addch_used) = 0;
224
} else if (len == -1) {
226
* An error occurred. We could either discard everything,
227
* or assume that the error was in the previous input.
230
TR(TRACE_VIRTPUT, ("Alert! mbrtowc returns error"));
231
/* handle this with unctrl() */
232
WINDOW_EXT(win, addch_used) = 0;
264
264
if (WINDOW_EXT(win, addch_used) != 0 || !Charable(ch)) {
265
265
int len = _nc_build_wch(win, CHREF(ch));
268
269
if (is8bits(CharOf(ch))) {
269
270
const char *s = unctrl((chtype) CharOf(ch));
271
272
return waddstr(win, s);
276
return waddch(win, ' ');
287
290
int len = wcwidth(CharOf(ch));
291
295
if (len == 0) { /* non-spacing */
292
296
if ((x > 0 && y >= 0)
293
|| ((y = win->_cury - 1) >= 0 &&
294
(x = win->_maxx) > 0)) {
295
wchar_t *chars = (win->_line[y].text[x - 1].chars);
297
|| (win->_maxx >= 0 && win->_cury >= 1)) {
299
chars = (win->_line[y].text[x - 1].chars);
301
chars = (win->_line[y - 1].text[win->_maxx].chars);
296
302
for (i = 0; i < CCHARW_MAX; ++i) {
297
303
if (chars[i] == 0) {
298
304
TR(TRACE_VIRTPUT,
474
480
NCURSES_CH_T sch;
475
481
SetChar(sch, *s++, AttrOf(ch));
482
if_EXT_COLORS(SetPair(sch, GetPair(ch)));
476
483
if (waddch_literal(win, sch) == ERR)