X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=ncurses%2Ftty%2Ftty_update.c;h=3addd02e745717ef290c12c7887c9e7b583cdc89;hp=02ec46264f31cee511affe38ae93d9cd0d62cbe4;hb=f486c68b1efe3bab5739c3f464fde6685a52bee5;hpb=3a0d9d27e0cf115ff9dcc6163c251bccaa62bd7d diff --git a/ncurses/tty/tty_update.c b/ncurses/tty/tty_update.c index 02ec4626..3addd02e 100644 --- a/ncurses/tty/tty_update.c +++ b/ncurses/tty/tty_update.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2008,2009 Free Software Foundation, Inc. * + * Copyright (c) 1998-2012,2013 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 * @@ -82,7 +82,7 @@ #include -MODULE_ID("$Id: tty_update.c,v 1.262 2009/10/24 23:21:31 tom Exp $") +MODULE_ID("$Id: tty_update.c,v 1.276 2013/02/16 21:12:02 tom Exp $") /* * This define controls the line-breakout optimization. Every once in a @@ -145,8 +145,7 @@ position_check(NCURSES_SP_DCLx int expected_y, int expected_x, char *legend) NCURSES_SP_NAME(_nc_flush) (NCURSES_SP_ARG); memset(buf, '\0', sizeof(buf)); - NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx "\033[6n"); /* only works on ANSI-compatibles */ - NCURSES_SP_NAME(_nc_flush) (NCURSES_SP_ARG); + NCURSES_PUTP2_FLUSH("cpr", "\033[6n"); /* only works on ANSI-compatibles */ *(s = buf) = 0; do { int ask = sizeof(buf) - 1 - (s - buf); @@ -209,7 +208,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 +277,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 /* @@ -288,13 +294,12 @@ PutAttrChar(NCURSES_SP_DCLx CARG_CH_T ch) int j = CharOfD(ch); chtype temp = UChar(SP_PARM->_acs_map[j]); - if (!(SP_PARM->_screen_acs_map[j])) { + if (temp != 0) { + SetChar(my_ch, temp, AttrOf(attr)); + } else { + my_ch = CHDEREF(ch); RemAttr(attr, A_ALTCHARSET); - if (temp == 0) - temp = ' '; } - if (temp != 0) - SetChar(my_ch, temp, AttrOf(attr)); } ch = CHREF(my_ch); } @@ -304,22 +309,13 @@ 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"); - NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx char_padding); + NCURSES_PUTP2("char_padding", char_padding); } } @@ -342,7 +338,7 @@ check_pending(NCURSES_SP_DCL0) struct pollfd fds[1]; fds[0].fd = SP_PARM->_checkfd; fds[0].events = POLLIN; - if (poll(fds, 1, 0) > 0) { + if (poll(fds, (size_t) 1, 0) > 0) { have_pending = TRUE; } #elif defined(__BEOS__) @@ -390,8 +386,7 @@ PutCharLR(NCURSES_SP_DCLx const ARG_CH_T ch) PutAttrChar(NCURSES_SP_ARGx ch); } else if (enter_am_mode && exit_am_mode) { /* we can suppress automargin */ - TPUTS_TRACE("exit_am_mode"); - NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx exit_am_mode); + NCURSES_PUTP2("exit_am_mode", exit_am_mode); PutAttrChar(NCURSES_SP_ARGx ch); SP_PARM->_curscol--; @@ -400,8 +395,7 @@ PutCharLR(NCURSES_SP_DCLx const ARG_CH_T ch) SP_PARM->_curscol, "exit_am_mode"); - TPUTS_TRACE("enter_am_mode"); - NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx enter_am_mode); + NCURSES_PUTP2("enter_am_mode", enter_am_mode); } else if ((enter_insert_mode && exit_insert_mode) || insert_character || parm_ich) { GoTo(NCURSES_SP_ARGx @@ -497,9 +491,12 @@ can_clear_with(NCURSES_SP_DCLx ARG_CH_T ch) return FALSE; if ((pair = GetPair(CHDEREF(ch))) != 0) { short fg, bg; - NCURSES_SP_NAME(pair_content) (NCURSES_SP_ARGx pair, &fg, &bg); - if (fg != C_MASK || bg != C_MASK) + if (NCURSES_SP_NAME(pair_content) (NCURSES_SP_ARGx + (short) pair, + &fg, &bg) == ERR + || (fg != C_MASK || bg != C_MASK)) { return FALSE; + } } #else if (AttrOfD(ch) & A_COLOR) @@ -561,8 +558,7 @@ EmitRange(NCURSES_SP_DCLx const NCURSES_CH_T * ntext, int num) && runcount > SP_PARM->_ech_cost + SP_PARM->_cup_ch_cost && can_clear_with(NCURSES_SP_ARGx CHREF(ntext0))) { UpdateAttrs(SP_PARM, ntext0); - NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx - TPARM_1(erase_chars, runcount)); + NCURSES_PUTP2("erase_chars", TPARM_1(erase_chars, runcount)); /* * If this is the last part of the given interval, @@ -675,6 +671,9 @@ TINFO_DOUPDATE(NCURSES_SP_DCL0) T((T_CALLED("_nc_tinfo:doupdate(%p)"), (void *) SP_PARM)); + if (SP_PARM == 0) + returnCode(ERR); + #if !USE_REENTRANT /* * It is "legal" but unlikely that an application could assign a new @@ -1074,11 +1073,11 @@ ClrUpdate(NCURSES_SP_DCL0) */ static void -ClrToEOL(NCURSES_SP_DCLx NCURSES_CH_T blank, bool needclear) +ClrToEOL(NCURSES_SP_DCLx NCURSES_CH_T blank, int needclear) { int j; - if (SP_PARM != 0 && CurScreen(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) { @@ -1091,15 +1090,12 @@ ClrToEOL(NCURSES_SP_DCLx NCURSES_CH_T blank, bool needclear) } } } - } else { - needclear = TRUE; } if (needclear) { UpdateAttrs(SP_PARM, blank); - TPUTS_TRACE("clr_eol"); if (clr_eol && SP_PARM->_el_cost <= (screen_columns(SP_PARM) - SP_PARM->_curscol)) { - NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx clr_eol); + NCURSES_PUTP2("clr_eol", clr_eol); } else { int count = (screen_columns(SP_PARM) - SP_PARM->_curscol); while (count-- > 0) @@ -1119,12 +1115,14 @@ ClrToEOS(NCURSES_SP_DCLx NCURSES_CH_T blank) { int row, col; - if (0 == SP_PARM) - return; - row = SP_PARM->_cursrow; col = SP_PARM->_curscol; + if (row < 0) + row = 0; + if (col < 0) + col = 0; + UpdateAttrs(SP_PARM, blank); TPUTS_TRACE("clr_eos"); NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx @@ -1368,13 +1366,11 @@ TransformLine(NCURSES_SP_DCLx int const lineno) && SP_PARM->_el_cost <= SP_PARM->_el1_cost) { GoTo(NCURSES_SP_ARGx lineno, 0); UpdateAttrs(SP_PARM, blank); - TPUTS_TRACE("clr_eol"); - NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx clr_eol); + NCURSES_PUTP2("clr_eol", clr_eol); } else { GoTo(NCURSES_SP_ARGx lineno, nFirstChar - 1); UpdateAttrs(SP_PARM, blank); - TPUTS_TRACE("clr_bol"); - NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx clr_bol); + NCURSES_PUTP2("clr_bol", clr_bol); } while (firstChar < nFirstChar) @@ -1413,7 +1409,7 @@ TransformLine(NCURSES_SP_DCLx int const lineno) nLastChar); memcpy(oldLine + firstChar, newLine + firstChar, - (nLastChar - firstChar + 1) * sizeof(NCURSES_CH_T)); + (unsigned) (nLastChar - firstChar + 1) * sizeof(NCURSES_CH_T)); } TR(TRACE_UPDATE, (T_RETURN(""))); return; @@ -1535,7 +1531,7 @@ TransformLine(NCURSES_SP_DCLx int const lineno) if (screen_columns(SP_PARM) > firstChar) memcpy(oldLine + firstChar, newLine + firstChar, - (screen_columns(SP_PARM) - firstChar) * sizeof(NCURSES_CH_T)); + (unsigned) (screen_columns(SP_PARM) - firstChar) * sizeof(NCURSES_CH_T)); TR(TRACE_UPDATE, (T_RETURN(""))); return; } @@ -1559,7 +1555,7 @@ ClearScreen(NCURSES_SP_DCLx NCURSES_CH_T blank) if (SP_PARM->_coloron && !SP_PARM->_default_color) { NCURSES_SP_NAME(_nc_do_color) (NCURSES_SP_ARGx - GET_SCREEN_PAIR(SP_PARM), + (short) GET_SCREEN_PAIR(SP_PARM), 0, FALSE, NCURSES_SP_NAME(_nc_outch)); @@ -1572,8 +1568,7 @@ ClearScreen(NCURSES_SP_DCLx NCURSES_CH_T blank) if (fast_clear) { if (clear_screen) { UpdateAttrs(SP_PARM, blank); - TPUTS_TRACE("clear_screen"); - NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx clear_screen); + NCURSES_PUTP2("clear_screen", clear_screen); SP_PARM->_cursrow = SP_PARM->_curscol = 0; position_check(SP_PARM, SP_PARM->_cursrow, @@ -1593,8 +1588,7 @@ ClearScreen(NCURSES_SP_DCLx NCURSES_CH_T blank) UpdateAttrs(SP_PARM, blank); for (i = 0; i < screen_lines(SP_PARM); i++) { GoTo(NCURSES_SP_ARGx i, 0); - TPUTS_TRACE("clr_eol"); - NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx clr_eol); + NCURSES_PUTP2("clr_eol", clr_eol); } GoTo(NCURSES_SP_ARGx 0, 0); } @@ -1645,27 +1639,22 @@ InsStr(NCURSES_SP_DCLx NCURSES_CH_T * line, int count) count--; } } else if (enter_insert_mode && exit_insert_mode) { - TPUTS_TRACE("enter_insert_mode"); - NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx enter_insert_mode); + NCURSES_PUTP2("enter_insert_mode", enter_insert_mode); while (count) { PutAttrChar(NCURSES_SP_ARGx CHREF(*line)); if (insert_padding) { - TPUTS_TRACE("insert_padding"); - NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx insert_padding); + NCURSES_PUTP2("insert_padding", insert_padding); } line++; count--; } - TPUTS_TRACE("exit_insert_mode"); - NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx exit_insert_mode); + NCURSES_PUTP2("exit_insert_mode", exit_insert_mode); } else { while (count) { - TPUTS_TRACE("insert_character"); - NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx insert_character); + NCURSES_PUTP2("insert_character", insert_character); PutAttrChar(NCURSES_SP_ARGx CHREF(*line)); if (insert_padding) { - TPUTS_TRACE("insert_padding"); - NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx insert_padding); + NCURSES_PUTP2("insert_padding", insert_padding); } line++; count--; @@ -1699,8 +1688,7 @@ DelChar(NCURSES_SP_DCLx int count) NCURSES_SP_NAME(_nc_outch)); } else { for (n = 0; n < count; n++) { - TPUTS_TRACE("delete_character"); - NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx delete_character); + NCURSES_PUTP2("delete_character", delete_character); } } } @@ -1752,13 +1740,11 @@ scroll_csr_forward(NCURSES_SP_DCLx if (n == 1 && scroll_forward && top == miny && bot == maxy) { GoTo(NCURSES_SP_ARGx bot, 0); UpdateAttrs(SP_PARM, blank); - TPUTS_TRACE("scroll_forward"); - NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx scroll_forward); + NCURSES_PUTP2("scroll_forward", scroll_forward); } else if (n == 1 && delete_line && bot == maxy) { GoTo(NCURSES_SP_ARGx top, 0); UpdateAttrs(SP_PARM, blank); - TPUTS_TRACE("delete_line"); - NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx delete_line); + NCURSES_PUTP2("delete_line", delete_line); } else if (parm_index && top == miny && bot == maxy) { GoTo(NCURSES_SP_ARGx bot, 0); UpdateAttrs(SP_PARM, blank); @@ -1779,15 +1765,13 @@ scroll_csr_forward(NCURSES_SP_DCLx GoTo(NCURSES_SP_ARGx bot, 0); UpdateAttrs(SP_PARM, blank); for (i = 0; i < n; i++) { - TPUTS_TRACE("scroll_forward"); - NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx scroll_forward); + NCURSES_PUTP2("scroll_forward", scroll_forward); } } else if (delete_line && bot == maxy) { GoTo(NCURSES_SP_ARGx top, 0); UpdateAttrs(SP_PARM, blank); for (i = 0; i < n; i++) { - TPUTS_TRACE("delete_line"); - NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx delete_line); + NCURSES_PUTP2("delete_line", delete_line); } } else return ERR; @@ -1821,13 +1805,11 @@ scroll_csr_backward(NCURSES_SP_DCLx if (n == 1 && scroll_reverse && top == miny && bot == maxy) { GoTo(NCURSES_SP_ARGx top, 0); UpdateAttrs(SP_PARM, blank); - TPUTS_TRACE("scroll_reverse"); - NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx scroll_reverse); + NCURSES_PUTP2("scroll_reverse", scroll_reverse); } else if (n == 1 && insert_line && bot == maxy) { GoTo(NCURSES_SP_ARGx top, 0); UpdateAttrs(SP_PARM, blank); - TPUTS_TRACE("insert_line"); - NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx insert_line); + NCURSES_PUTP2("insert_line", insert_line); } else if (parm_rindex && top == miny && bot == maxy) { GoTo(NCURSES_SP_ARGx top, 0); UpdateAttrs(SP_PARM, blank); @@ -1848,15 +1830,13 @@ scroll_csr_backward(NCURSES_SP_DCLx GoTo(NCURSES_SP_ARGx top, 0); UpdateAttrs(SP_PARM, blank); for (i = 0; i < n; i++) { - TPUTS_TRACE("scroll_reverse"); - NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx scroll_reverse); + NCURSES_PUTP2("scroll_reverse", scroll_reverse); } } else if (insert_line && bot == maxy) { GoTo(NCURSES_SP_ARGx top, 0); UpdateAttrs(SP_PARM, blank); for (i = 0; i < n; i++) { - TPUTS_TRACE("insert_line"); - NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx insert_line); + NCURSES_PUTP2("insert_line", insert_line); } } else return ERR; @@ -1887,8 +1867,7 @@ scroll_idl(NCURSES_SP_DCLx int n, int del, int ins, NCURSES_CH_T blank) GoTo(NCURSES_SP_ARGx del, 0); UpdateAttrs(SP_PARM, blank); if (n == 1 && delete_line) { - TPUTS_TRACE("delete_line"); - NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx delete_line); + NCURSES_PUTP2("delete_line", delete_line); } else if (parm_delete_line) { TPUTS_TRACE("parm_delete_line"); NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx @@ -1897,16 +1876,14 @@ scroll_idl(NCURSES_SP_DCLx int n, int del, int ins, NCURSES_CH_T blank) NCURSES_SP_NAME(_nc_outch)); } else { /* if (delete_line) */ for (i = 0; i < n; i++) { - TPUTS_TRACE("delete_line"); - NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx delete_line); + NCURSES_PUTP2("delete_line", delete_line); } } GoTo(NCURSES_SP_ARGx ins, 0); UpdateAttrs(SP_PARM, blank); if (n == 1 && insert_line) { - TPUTS_TRACE("insert_line"); - NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx insert_line); + NCURSES_PUTP2("insert_line", insert_line); } else if (parm_insert_line) { TPUTS_TRACE("parm_insert_line"); NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx @@ -1915,8 +1892,7 @@ scroll_idl(NCURSES_SP_DCLx int n, int del, int ins, NCURSES_CH_T blank) NCURSES_SP_NAME(_nc_outch)); } else { /* if (insert_line) */ for (i = 0; i < n; i++) { - TPUTS_TRACE("insert_line"); - NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx insert_line); + NCURSES_PUTP2("insert_line", insert_line); } } @@ -1973,24 +1949,20 @@ NCURSES_SP_NAME(_nc_scrolln) (NCURSES_SP_DCLx && (SP_PARM->_cursrow == bot || SP_PARM->_cursrow == bot - 1)) && save_cursor && restore_cursor) { cursor_saved = TRUE; - TPUTS_TRACE("save_cursor"); - NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx save_cursor); + NCURSES_PUTP2("save_cursor", save_cursor); } - TPUTS_TRACE("change_scroll_region"); - NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx - TPARM_2(change_scroll_region, top, bot)); + NCURSES_PUTP2("change_scroll_region", + TPARM_2(change_scroll_region, top, bot)); if (cursor_saved) { - TPUTS_TRACE("restore_cursor"); - NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx restore_cursor); + NCURSES_PUTP2("restore_cursor", restore_cursor); } else { SP_PARM->_cursrow = SP_PARM->_curscol = -1; } res = scroll_csr_forward(NCURSES_SP_ARGx n, top, bot, top, bot, blank); - TPUTS_TRACE("change_scroll_region"); - NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx - TPARM_2(change_scroll_region, 0, maxy)); + NCURSES_PUTP2("change_scroll_region", + TPARM_2(change_scroll_region, 0, maxy)); SP_PARM->_cursrow = SP_PARM->_curscol = -1; } @@ -2023,15 +1995,12 @@ NCURSES_SP_NAME(_nc_scrolln) (NCURSES_SP_DCLx SP_PARM->_cursrow == top - 1) && save_cursor && restore_cursor) { cursor_saved = TRUE; - TPUTS_TRACE("save_cursor"); - NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx save_cursor); + NCURSES_PUTP2("save_cursor", save_cursor); } - TPUTS_TRACE("change_scroll_region"); - NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx - TPARM_2(change_scroll_region, top, bot)); + NCURSES_PUTP2("change_scroll_region", + TPARM_2(change_scroll_region, top, bot)); if (cursor_saved) { - TPUTS_TRACE("restore_cursor"); - NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx restore_cursor); + NCURSES_PUTP2("restore_cursor", restore_cursor); } else { SP_PARM->_cursrow = SP_PARM->_curscol = -1; } @@ -2039,9 +2008,8 @@ NCURSES_SP_NAME(_nc_scrolln) (NCURSES_SP_DCLx res = scroll_csr_backward(NCURSES_SP_ARGx -n, top, bot, top, bot, blank); - TPUTS_TRACE("change_scroll_region"); - NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx - TPARM_2(change_scroll_region, 0, maxy)); + NCURSES_PUTP2("change_scroll_region", + TPARM_2(change_scroll_region, 0, maxy)); SP_PARM->_cursrow = SP_PARM->_curscol = -1; } @@ -2064,7 +2032,10 @@ NCURSES_SP_NAME(_nc_scrolln) (NCURSES_SP_DCLx if (res == ERR) return (ERR); - _nc_scroll_window(CurScreen(SP_PARM), n, top, bot, blank); + _nc_scroll_window(CurScreen(SP_PARM), n, + (NCURSES_SIZE_T) top, + (NCURSES_SIZE_T) bot, + blank); /* shift hash values too - they can be reused */ NCURSES_SP_NAME(_nc_scroll_oldhash) (NCURSES_SP_ARGx n, top, bot); @@ -2099,7 +2070,8 @@ NCURSES_SP_NAME(_nc_screen_resume) (NCURSES_SP_DCL0) SP_PARM->_color_defs = -(SP_PARM->_color_defs); for (n = 0; n < SP_PARM->_color_defs; ++n) { if (SP_PARM->_color_table[n].init) { - NCURSES_SP_NAME(init_color) (NCURSES_SP_ARGx n, + NCURSES_SP_NAME(init_color) (NCURSES_SP_ARGx + (short) n, SP_PARM->_color_table[n].r, SP_PARM->_color_table[n].g, SP_PARM->_color_table[n].b); @@ -2108,23 +2080,25 @@ NCURSES_SP_NAME(_nc_screen_resume) (NCURSES_SP_DCL0) } if (exit_attribute_mode) - NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx exit_attribute_mode); + NCURSES_PUTP2("exit_attribute_mode", exit_attribute_mode); else { /* turn off attributes */ if (exit_alt_charset_mode) - NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx exit_alt_charset_mode); + NCURSES_PUTP2("exit_alt_charset_mode", exit_alt_charset_mode); if (exit_standout_mode) - NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx exit_standout_mode); + NCURSES_PUTP2("exit_standout_mode", exit_standout_mode); if (exit_underline_mode) - NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx exit_underline_mode); + NCURSES_PUTP2("exit_underline_mode", exit_underline_mode); } if (exit_insert_mode) - NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx exit_insert_mode); - if (enter_am_mode && exit_am_mode) - NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx - (auto_right_margin - ? enter_am_mode - : exit_am_mode)); + NCURSES_PUTP2("exit_insert_mode", exit_insert_mode); + if (enter_am_mode && exit_am_mode) { + if (auto_right_margin) { + NCURSES_PUTP2("enter_am_mode", enter_am_mode); + } else { + NCURSES_PUTP2("exit_am_mode", exit_am_mode); + } + } } #if NCURSES_SP_FUNCS @@ -2153,33 +2127,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); + } } }