From 1432e449b2a39e030a685d4de46a175b2eccb8ba Mon Sep 17 00:00:00 2001 From: William McBrine Date: Mon, 6 Nov 2006 20:45:02 +0000 Subject: [PATCH] Fewer tests on the normal path through PDC_chadd(). --- pdcurses/addch.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/pdcurses/addch.c b/pdcurses/addch.c index ac679c96..3e88c6a3 100644 --- a/pdcurses/addch.c +++ b/pdcurses/addch.c @@ -13,7 +13,7 @@ #include -RCSID("$Id: addch.c,v 1.38 2006/11/06 14:09:49 wmcbrine Exp $"); +RCSID("$Id: addch.c,v 1.39 2006/11/06 20:45:02 wmcbrine Exp $"); /*man-start************************************************************** @@ -125,7 +125,7 @@ RCSID("$Id: addch.c,v 1.38 2006/11/06 14:09:49 wmcbrine Exp $"); int PDC_chadd(WINDOW *win, chtype ch, bool advance) { - int x, y, x2; + int x, y; chtype attr; bool xlat; @@ -142,8 +142,6 @@ int PDC_chadd(WINDOW *win, chtype ch, bool advance) if (y > win->_maxy || x > win->_maxx || y < 0 || x < 0) return ERR; - xlat = !SP->raw_out && !(ch & A_ALTCHARSET); - /* If the incoming character doesn't have its own attribute, then use the current attributes for the window. If it has attributes but not a color component, OR the attributes to @@ -165,13 +163,17 @@ int PDC_chadd(WINDOW *win, chtype ch, bool advance) else attr |= win->_bkgd & (A_ATTRIBUTES ^ A_COLOR); + xlat = !SP->raw_out && !(ch & A_ALTCHARSET); + ch &= A_CHARTEXT; if (ch == ' ') ch = win->_bkgd & A_CHARTEXT; - if (xlat) + if (xlat && (ch < ' ' || ch == 0x7f)) { + int x2; + switch (ch) { case '\t': @@ -236,10 +238,8 @@ int PDC_chadd(WINDOW *win, chtype ch, bool advance) return ERR; return waddch(win, '?'); - } - if (ch < ' ') - { + default: /* handle control chars */ if (waddch(win, '^') == ERR)