--- rxvt-unicode/src/screen.C 2004/02/24 00:44:23 1.34 +++ rxvt-unicode/src/screen.C 2004/02/25 10:26:50 1.38 @@ -3,6 +3,7 @@ *---------------------------------------------------------------------------* * * Copyright (c) 1997-2001 Geoff Wing + * Copyright (c) 2003-2004 Marc Lehmann * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,8 +19,9 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *--------------------------------------------------------------------------*/ + /* - * We handle _all_ screen updates and selections + * This file handles _all_ screen updates and selections */ #include "../config.h" /* NECESSARY */ @@ -32,7 +34,7 @@ #include #include -#include "salloc.C" // HACK!! +#include "salloc.C" // HACK, should be a seperate compile! inline void fill_text (text_t *start, text_t value, int len) { @@ -864,17 +866,23 @@ if (charsets[screen.charset] == '0') // DEC SPECIAL switch (c) { + // dunno where these come from +#if 0 case '+': c = 0x2192; break; case ',': c = 0x2190; break; case '-': c = 0x2191; break; - case '.': c = 0x2193; break; case '0': c = 0x25ae; break; case '`': c = 0x25c6; break; - case 'a': c = 0x2592; break; case 'f': c = 0x00b0; break; case 'g': c = 0x00b1; break; - case 'h': c = 0x2592; break; case 'i': c = 0x2603; break; case 'j': c = 0x2518; break; - case 'k': c = 0x2510; break; case 'l': c = 0x250c; break; case 'm': c = 0x2514; break; - case 'n': c = 0x253c; break; case 'o': c = 0x23ba; break; case 'p': c = 0x23bb; break; - case 'q': c = 0x2500; break; case 'r': c = 0x23bc; break; case 's': c = 0x23bd; break; - case 't': c = 0x251c; break; case 'u': c = 0x2524; break; case 'v': c = 0x2534; break; - case 'w': c = 0x252c; break; case 'x': c = 0x2502; break; case 'y': c = 0x2264; break; - case 'z': c = 0x2265; break; case '{': c = 0x03c0; break; case '|': c = 0x2260; break; - case '}': c = 0x00a3; break; case '~': c = 0x00b7; break; + case '.': c = 0x2193; break; case '0': c = 0x25ae; break; +#endif + // vt100 special graphics and line drawing + case '`': c = 0x25c6; break; case '_': c = 0x0020; break; + case 'a': c = 0x2592; break; case 'b': c = 0x2409; break; case 'c': c = 0x240c; break; + case 'd': c = 0x240d; break; case 'e': c = 0x240a; break; case 'f': c = 0x00b0; break; + case 'g': c = 0x00b1; break; case 'h': c = 0x2424; break; case 'i': c = 0x240b; break; + case 'j': c = 0x2518; break; case 'k': c = 0x2510; break; case 'l': c = 0x250c; break; + case 'm': c = 0x2514; break; case 'n': c = 0x253c; break; case 'o': c = 0x23ba; break; + case 'p': c = 0x23bb; break; case 'q': c = 0x2500; break; case 'r': c = 0x23bc; break; + case 's': c = 0x23bd; break; case 't': c = 0x251c; break; case 'u': c = 0x2524; break; + case 'v': c = 0x2534; break; case 'w': c = 0x252c; break; case 'x': c = 0x2502; break; + case 'y': c = 0x2264; break; case 'z': c = 0x2265; break; case '{': c = 0x03c0; break; + case '|': c = 0x2260; break; case '}': c = 0x00a3; break; case '~': c = 0x00b7; break; } rend_t rend = SET_FONT (rstyle, TermWin.fontset->find_font (c)); @@ -1837,21 +1845,20 @@ void rxvt_term::scr_refresh (unsigned char refresh_type) { - unsigned char clearfirst, /* first character writes before cell */ - clearlast, /* last character writes beyond cell */ - must_clear, /* use draw_string not draw_image_string */ - rvid, /* reverse video this position */ - showcursor; /* show the cursor */ - int16_t col, row, /* column/row we're processing */ - ocrow; /* old cursor row */ - int cursorwidth; - int i, /* tmp */ - row_offset; /* basic offset in screen structure */ + unsigned char clearfirst, /* first character writes before cell */ + clearlast, /* last character writes beyond cell */ + must_clear, /* use draw_string not draw_image_string */ + rvid, /* reverse video this position */ + showcursor; /* show the cursor */ + int16_t col, row, /* column/row we're processing */ + ocrow; /* old cursor row */ + int i, /* tmp */ + row_offset; /* basic offset in screen structure */ #ifndef NO_CURSORCOLOR - rend_t cc1; /* store colours at cursor position (s) */ + rend_t cc1; /* store colours at cursor position (s) */ #endif - rend_t *drp, *srp; /* drawn-rend-pointer, screen-rend-pointer */ - text_t *dtp, *stp; /* drawn-text-pointer, screen-text-pointer */ + rend_t *drp, *srp; /* drawn-rend-pointer, screen-rend-pointer */ + text_t *dtp, *stp; /* drawn-text-pointer, screen-text-pointer */ if (refresh_type == NO_REFRESH || !TermWin.mapped) return; @@ -1893,18 +1900,13 @@ ccol2; /* Cursor colour2 */ showcursor = (screen.flags & Screen_VisibleCursor); - cursorwidth = 0; #ifdef CURSOR_BLINK if (hidden_cursor) showcursor = 0; #endif - cursorwidth = 0; - if (showcursor) { - cursorwidth++; - srp = & (screen.rend[screen.cur.row + TermWin.saveLines] [screen.cur.col]); @@ -1932,7 +1934,6 @@ *srp = SET_FGCOLOR (*srp, ccol1); *srp = SET_BGCOLOR (*srp, ccol2); #endif - } } @@ -2123,7 +2124,24 @@ rend = GET_ATTR (rend); - rvid = !! (rend & RS_RVid); + rvid = !!(rend & RS_RVid); + +#ifndef NO_BOLD_UNDERLINE_REVERSE + if (rend & RS_Bold && fore == Color_fg) + { + if (ISSET_PIXCOLOR (Color_BD)) + fore = Color_BD; + else + rvid = !rvid; + } + + if (rend & RS_Uline) + { + if (ISSET_PIXCOLOR (Color_UL)) + fore = Color_UL; + } +#endif + if (rvid) { SWAP_IT (fore, back, int); @@ -2136,8 +2154,8 @@ ) back = Color_RV; #endif - } + #ifdef TEXT_BLINK if (rend & RS_Blink) { @@ -2150,20 +2168,6 @@ fore = back; } #endif -#ifndef NO_BOLD_UNDERLINE_REVERSE - else if (rend & RS_Bold) - { - if (ISSET_PIXCOLOR (Color_BD)) - fore = Color_BD; - else if (fore == Color_fg) - fore = Color_White; - } - else if (rend & RS_Uline) - { - if (ISSET_PIXCOLOR (Color_UL)) - fore = Color_UL; - } -#endif /* * Actually do the drawing of the string here @@ -2213,7 +2217,6 @@ #ifndef NO_CURSORCOLOR *srp = (*srp & ~ (RS_fgMask | RS_bgMask)) | cc1; #endif - } else if (oldcursor.row >= 0) { @@ -2221,6 +2224,11 @@ if (ISSET_PIXCOLOR (Color_cursor)) XSetForeground (display->display, TermWin.gc, PixColors[Color_cursor]); #endif + int cursorwidth = 1; + while (oldcursor.col + cursorwidth < TermWin.ncol + && drawn_text[oldcursor.row][oldcursor.col + cursorwidth] == NOCHAR) + cursorwidth++; + XDrawRectangle (display->display, drawBuffer, TermWin.gc, Col2Pixel (oldcursor.col), Row2Pixel (oldcursor.row), @@ -2484,10 +2492,10 @@ for (;;) { if (XGetWindowProperty (display->display, win, prop, (long) (nread / 4), - (long) (PROP_SIZE / 4), delete_prop, - AnyPropertyType, &ct.encoding, &ct.format, - &ct.nitems, &bytes_after, - &ct.value) != Success) + (long) (PROP_SIZE / 4), delete_prop, + AnyPropertyType, &ct.encoding, &ct.format, + &ct.nitems, &bytes_after, + &ct.value) != Success) break; if (ct.encoding == 0) @@ -2505,7 +2513,8 @@ if (ct.nitems == 0) { D_SELECT ((stderr, "rxvt_selection_paste: property empty - also INCR end")); - if (selection_wait == Sel_normal && nread == 0) + if (selection_wait == Sel_normal && nread == 0 + && (win != display->root || prop != XA_CUT_BUFFER0)) // avoid recursion { /* * pass through again trying CUT_BUFFER0 if we've come from