X-Git-Url: http://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=ncurses%2Fbase%2Flib_insch.c;h=9166ea5240e7f3adf62c9631bca98ffd50847dfa;hp=b8a856df3a82fc9c0c157b437ab2e8439338727c;hb=b779f5fb4516b3e6d1bc8880ea68923efb761e1d;hpb=25358bc041a5566ce2de4c9c792837e552b35671 diff --git a/ncurses/base/lib_insch.c b/ncurses/base/lib_insch.c index b8a856df..9166ea52 100644 --- a/ncurses/base/lib_insch.c +++ b/ncurses/base/lib_insch.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2004,2005 Free Software Foundation, Inc. * + * Copyright (c) 1998-2005,2008 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 * @@ -43,7 +43,7 @@ #include #include -MODULE_ID("$Id: lib_insch.c,v 1.24 2005/02/26 19:27:28 tom Exp $") +MODULE_ID("$Id: lib_insch.c,v 1.25 2008/02/03 00:14:37 tom Exp $") /* * Insert the given character, updating the current location to simplify @@ -95,7 +95,8 @@ _nc_insert_ch(WINDOW *win, chtype ch) } else if (is8bits(ChCharOf(ch)) && iscntrl(ChCharOf(ch))) { s = unctrl(ChCharOf(ch)); while (*s != '\0') { - if ((code = _nc_insert_ch(win, ChAttrOf(ch) | UChar(*s))) != OK) + code = _nc_insert_ch(win, ChAttrOf(ch) | UChar(*s)); + if (code != OK) break; ++s; } @@ -107,8 +108,23 @@ _nc_insert_ch(WINDOW *win, chtype ch) */ SetChar2(wch, ch); wch = _nc_render(win, wch); - if (_nc_build_wch(win, &wch) >= 0) + count = _nc_build_wch(win, &wch); + if (count > 0) { code = wins_wch(win, &wch); + } else if (count == -1) { + /* handle EILSEQ */ + if (is8bits(ch)) { + s = unctrl(ChCharOf(ch)); + while (*s != '\0') { + code = _nc_insert_ch(win, ChAttrOf(ch) | UChar(*s)); + if (code != OK) + break; + ++s; + } + } else { + code = ERR; + } + } } #endif break;