]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - ncurses/tty/tty_update.c
ncurses 5.9 - patch 20121222
[ncurses.git] / ncurses / tty / tty_update.c
index 77ae1bbff0b7f75eab28a5e73d23d16d73a19aec..01feddd9183ae4983d4f21baaaac9c68cf7d4fd4 100644 (file)
@@ -82,7 +82,7 @@
 
 #include <ctype.h>
 
-MODULE_ID("$Id: tty_update.c,v 1.268 2012/05/12 21:02:00 tom Exp $")
+MODULE_ID("$Id: tty_update.c,v 1.273 2012/12/22 21:38:17 tom Exp $")
 
 /*
  * This define controls the line-breakout optimization.  Every once in a
@@ -209,7 +209,9 @@ PutAttrChar(NCURSES_SP_DCLx CARG_CH_T ch)
 {
     int chlen = 1;
     NCURSES_CH_T my_ch;
+#if USE_WIDEC_SUPPORT
     PUTC_DATA;
+#endif
     NCURSES_CH_T tilde;
     NCURSES_CH_T attr = CHDEREF(ch);
 
@@ -276,6 +278,11 @@ PutAttrChar(NCURSES_SP_DCLx CARG_CH_T ch)
            && SP_PARM->_screen_acs_map[CharOf(my_ch)]) {
            RemAttr(attr, A_ALTCHARSET);
            my_ch = _nc_wacs[CharOf(my_ch)];
+       } else if (SP_PARM->_screen_unicode
+                  && !SP_PARM->_screen_acs_map[CharOf(my_ch)]
+                  && _nc_wacs[CharOf(my_ch)].chars[0]) {
+           RemAttr(attr, A_ALTCHARSET);
+           my_ch = _nc_wacs[CharOf(my_ch)];
        }
 #endif
        /*
@@ -303,18 +310,10 @@ PutAttrChar(NCURSES_SP_DCLx CARG_CH_T ch)
     }
 
     UpdateAttrs(SP_PARM, attr);
+    PUTC(CHDEREF(ch));
 #if !USE_WIDEC_SUPPORT
-    /* FIXME - we do this special case for signal handling, should see how to
-     * make it work for wide characters.
-     */
-    if (SP_PARM->_outch != 0) {
-       SP_PARM->_outch(NCURSES_SP_ARGx UChar(ch));
-    } else
+    COUNT_OUTCHARS(1);
 #endif
-    {
-       PUTC(CHDEREF(ch), SP_PARM->_ofp);       /* macro's fastest... */
-       COUNT_OUTCHARS(1);
-    }
     SP_PARM->_curscol += chlen;
     if (char_padding) {
        TPUTS_TRACE("char_padding");
@@ -1082,24 +1081,22 @@ ClrToEOL(NCURSES_SP_DCLx NCURSES_CH_T blank, int needclear)
 {
     int j;
 
-    if (SP_PARM != 0) {
-       if (CurScreen(SP_PARM) != 0
-           && SP_PARM->_cursrow >= 0) {
-           for (j = SP_PARM->_curscol; j < screen_columns(SP_PARM); j++) {
-               if (j >= 0) {
-                   NCURSES_CH_T *cp =
-                   &(CurScreen(SP_PARM)->_line[SP_PARM->_cursrow].text[j]);
-
-                   if (!CharEq(*cp, blank)) {
-                       *cp = blank;
-                       needclear = TRUE;
-                   }
+    if (CurScreen(SP_PARM) != 0
+       && SP_PARM->_cursrow >= 0) {
+       for (j = SP_PARM->_curscol; j < screen_columns(SP_PARM); j++) {
+           if (j >= 0) {
+               NCURSES_CH_T *cp =
+               &(CurScreen(SP_PARM)->_line[SP_PARM->_cursrow].text[j]);
+
+               if (!CharEq(*cp, blank)) {
+                   *cp = blank;
+                   needclear = TRUE;
                }
            }
        }
     }
 
-    if (needclear && (SP_PARM != 0)) {
+    if (needclear) {
        UpdateAttrs(SP_PARM, blank);
        TPUTS_TRACE("clr_eol");
        if (clr_eol && SP_PARM->_el_cost <= (screen_columns(SP_PARM) - SP_PARM->_curscol)) {
@@ -1123,9 +1120,6 @@ ClrToEOS(NCURSES_SP_DCLx NCURSES_CH_T blank)
 {
     int row, col;
 
-    if (0 == SP_PARM)
-       return;
-
     row = SP_PARM->_cursrow;
     col = SP_PARM->_curscol;
 
@@ -2161,33 +2155,33 @@ _nc_screen_init(void)
 NCURSES_EXPORT(void)
 NCURSES_SP_NAME(_nc_screen_wrap) (NCURSES_SP_DCL0)
 {
-    if (SP_PARM == 0)
-       return;
+    if (SP_PARM != 0) {
 
-    UpdateAttrs(SP_PARM, normal);
+       UpdateAttrs(SP_PARM, normal);
 #if NCURSES_EXT_FUNCS
-    if (SP_PARM->_coloron
-       && !SP_PARM->_default_color) {
-       static const NCURSES_CH_T blank = NewChar(BLANK_TEXT);
-       SP_PARM->_default_color = TRUE;
-       NCURSES_SP_NAME(_nc_do_color) (NCURSES_SP_ARGx
-                                      -1,
-                                      0,
-                                      FALSE,
-                                      NCURSES_SP_NAME(_nc_outch));
-       SP_PARM->_default_color = FALSE;
-
-       TINFO_MVCUR(NCURSES_SP_ARGx
-                   SP_PARM->_cursrow,
-                   SP_PARM->_curscol,
-                   screen_lines(SP_PARM) - 1,
-                   0);
-
-       ClrToEOL(NCURSES_SP_ARGx blank, TRUE);
-    }
+       if (SP_PARM->_coloron
+           && !SP_PARM->_default_color) {
+           static const NCURSES_CH_T blank = NewChar(BLANK_TEXT);
+           SP_PARM->_default_color = TRUE;
+           NCURSES_SP_NAME(_nc_do_color) (NCURSES_SP_ARGx
+                                          -1,
+                                          0,
+                                          FALSE,
+                                          NCURSES_SP_NAME(_nc_outch));
+           SP_PARM->_default_color = FALSE;
+
+           TINFO_MVCUR(NCURSES_SP_ARGx
+                       SP_PARM->_cursrow,
+                       SP_PARM->_curscol,
+                       screen_lines(SP_PARM) - 1,
+                       0);
+
+           ClrToEOL(NCURSES_SP_ARGx blank, TRUE);
+       }
 #endif
-    if (SP_PARM->_color_defs) {
-       NCURSES_SP_NAME(_nc_reset_colors) (NCURSES_SP_ARG);
+       if (SP_PARM->_color_defs) {
+           NCURSES_SP_NAME(_nc_reset_colors) (NCURSES_SP_ARG);
+       }
     }
 }