--- rxvt-unicode/src/screen.C 2003/12/18 13:33:03 1.11 +++ rxvt-unicode/src/screen.C 2004/01/19 17:26:43 1.17 @@ -1,7 +1,6 @@ /*--------------------------------*-C-*--------------------------------------* * File: screen.c *---------------------------------------------------------------------------* - * $Id: screen.C,v 1.11 2003/12/18 13:33:03 pcg Exp $ * * Copyright (c) 1997-2001 Geoff Wing * @@ -291,7 +290,7 @@ /* add rows */ scr_reset_realloc (); /* realloc _first_ */ - TermWin.ncol = prev_ncol; // save b/c scr_blank_screen_mem uses this + TermWin.ncol = prev_ncol; // save b/c scr_blank_screen_mem uses this k = min (TermWin.nscrolled, nrow - prev_nrow); @@ -449,8 +448,8 @@ } #endif - delete talloc; - delete ralloc; + delete talloc; talloc = 0; + delete ralloc; ralloc = 0; free (screen.text); free (screen.tlen); @@ -901,39 +900,35 @@ } rend_t rend = SET_FONT (R->rstyle, R->TermWin.fontset->find_font (c)); + // rely on wcwidth to tell us the character width, at least for non-ascii + int width = c <= 128 ? 1 : wcwidth (c); - stp[R->screen.cur.col] = c; - srp[R->screen.cur.col] = rend; - - if (c > 255) - { - // rely on wcwidth to tell us the character width, at least for non iso-8859-1 - int width = wcwidth (c); - - if (width > 1) - { - while (--width > 0 && R->screen.cur.col < last_col - 1) - { - - srp[R->screen.cur.col] |= RS_wide; + // width -1 characters (e.g. combining chars) are ignored currently. + if (width > 0) + do + { + stp[R->screen.cur.col] = c; + srp[R->screen.cur.col] = rend; - R->screen.cur.col++; - stp[R->screen.cur.col] = NOCHAR; - srp[R->screen.cur.col] = rend; - } - } - } + if (R->screen.cur.col < last_col - 1) + R->screen.cur.col++; + else + { + R->screen.tlen[row] = last_col; + if (R->screen.flags & Screen_Autowrap) + R->screen.flags |= Screen_WrapNext; + break; + } - if (R->screen.cur.col < last_col - 1) - R->screen.cur.col++; - else { - R->screen.tlen[row] = last_col; - if (R->screen.flags & Screen_Autowrap) - R->screen.flags |= Screen_WrapNext; - } + c = NOCHAR; + } + while (--width > 0); + else + 1; /* handle combining character etc. here. */ } + if (R->screen.tlen[row] != -1) /* XXX: think about this */ - MAX_IT(R->screen.tlen[row], R->screen.cur.col); + MAX_IT(R->screen.tlen[row], R->screen.cur.col); /* * If we wrote anywhere in the selected area, kill the selection @@ -1652,27 +1647,6 @@ /* ------------------------------------------------------------------------- * - * GRAPHICS COLOURS * - * ------------------------------------------------------------------------- */ - -#ifdef RXVT_GRAPHICS -/* EXTPROTO */ -int -rxvt_scr_get_fgcolor(pR) -{ - return GET_FGCOLOR(R->rstyle); -} - -/* ------------------------------------------------------------------------- */ -/* EXTPROTO */ -int -rxvt_scr_get_bgcolor(pR) -{ - return GET_BGCOLOR(R->rstyle); -} -#endif - -/* ------------------------------------------------------------------------- * * MAJOR SCREEN MANIPULATION * * ------------------------------------------------------------------------- */ @@ -1861,15 +1835,6 @@ * R->screen.text/R->screen.rend contain what the screen will change to. */ -#if defined (NO_BRIGHTCOLOR) || defined (VERYBOLD) -# define MONO_BOLD(x) ((x) & (RS_Bold|RS_Blink)) -# define MONO_BOLD_FG(x, fg) MONO_BOLD(x) -#else -# define MONO_BOLD(x) \ - (((x) & (RS_Bold | RS_fgMask)) == (RS_Bold | Color_fg)) -# define MONO_BOLD_FG(x, fg) (((x) & RS_Bold) && (fg) == Color_fg) -#endif - #define FONT_WIDTH(X, Y) \ (X)->per_char[(Y) - (X)->min_char_or_byte2].width #define FONT_RBEAR(X, Y) \ @@ -1885,13 +1850,8 @@ unsigned char clearfirst, /* first character writes before cell */ clearlast, /* last character writes beyond cell */ must_clear, /* use draw_string not draw_image_string */ -#ifndef NO_BOLDFONT - bfont, /* we've changed font to bold font */ -#endif rvid, /* reverse video this position */ - wbyte, /* we're in multibyte */ showcursor; /* show the cursor */ - int fore, back; /* desired foreground/background */ int16_t col, row, /* column/row we're processing */ ocrow; /* old cursor row */ int cursorwidth; @@ -1903,7 +1863,6 @@ #endif rend_t *drp, *srp; /* drawn-rend-pointer, screen-rend-pointer */ text_t *dtp, *stp; /* drawn-text-pointer, screen-text-pointer */ - char *buffer; /* local copy of buffer */ if (refresh_type == NO_REFRESH || !TermWin.mapped) return; @@ -1911,10 +1870,7 @@ /* * A: set up vars */ - clearfirst = clearlast = must_clear = wbyte = 0; -#ifndef NO_BOLDFONT - bfont = 0; -#endif + clearfirst = clearlast = must_clear = 0; if (currmaxcol < TermWin.ncol) { @@ -1923,7 +1879,6 @@ sizeof(char) * (currmaxcol + 1) * MB_CUR_MAX); } - buffer = buffer; refresh_count = 0; row_offset = TermWin.saveLines - TermWin.view_start; @@ -1942,14 +1897,14 @@ #endif ocrow = oldcursor.row; /* is there an old outline cursor on screen? */ -/* - * B: reverse any characters which are selected - */ + /* + * B: reverse any characters which are selected + */ rxvt_scr_reverse_selection (this); -/* - * C: set the cursor character(s) - */ + /* + * C: set the cursor character(s) + */ { unsigned char setoldcursor; rend_t ccol1, /* Cursor colour */ @@ -1996,9 +1951,6 @@ *srp = SET_BGCOLOR(*srp, ccol2); #endif } - - while (IS_WIDE (*srp)) - cursorwidth++, srp++; } /* make sure no outline cursor is left around */ @@ -2028,10 +1980,10 @@ } #ifndef NO_SLOW_LINK_SUPPORT -/* - * D: CopyArea pass - very useful for slower links - * This has been deliberately kept simple. - */ + /* + * D: CopyArea pass - very useful for slower links + * This has been deliberately kept simple. + */ i = num_scr; if (refresh_type == FAST_REFRESH && num_scr_allow && i && abs(i) < TermWin.nrow && !must_clear) @@ -2096,9 +2048,9 @@ } #endif -/* - * E: main pass across every character - */ + /* + * E: main pass across every character + */ for (row = 0; row < TermWin.nrow; row++) { stp = screen.text[row + row_offset]; @@ -2106,9 +2058,9 @@ dtp = drawn_text[row]; drp = drawn_rend[row]; -/* - * E2: OK, now the real pass - */ + /* + * E2: OK, now the real pass + */ int ypixel = (int)Row2Pixel(row); for (col = 0; col < TermWin.ncol; col++) @@ -2151,7 +2103,7 @@ continue; } - if (((rend ^ srp[col]) & ~RS_wide) != 0) + if (rend != srp[col]) break; count++; @@ -2173,15 +2125,16 @@ col--; /* went one too far. move back */ count -= i; /* dump any matching trailing chars */ -/* - * Determine the attributes for the string - */ - int fid = GET_FONT(rend); - fore = GET_FGCOLOR(rend); - back = GET_BGCOLOR(rend); - rend = GET_ATTR(rend); + /* + * Determine the attributes for the string + */ + int fid = GET_FONT (rend); + int fore = GET_FGCOLOR (rend); // desired foreground + int back = GET_BGCOLOR (rend); // desired background + + rend = GET_ATTR (rend); - rvid = (rend & RS_RVid) ? 1 : 0; + rvid = !!(rend & RS_RVid); #ifdef OPTION_HC if (!rvid && (rend & RS_Blink)) { @@ -2208,26 +2161,18 @@ else if (rend & RS_Bold) { if (Xdepth > 2 && ISSET_PIXCOLOR (this, Color_BD)) - { - fore = Color_BD; -# ifndef VERYBOLD - rend &= ~RS_Bold; /* we've taken care of it */ -# endif - } + fore = Color_BD; } else if (rend & RS_Uline) { if (Xdepth > 2 && ISSET_PIXCOLOR (this, Color_UL)) - { - fore = Color_UL; - rend &= ~RS_Uline; /* we've taken care of it */ - } + fore = Color_UL; } #endif -/* - * Actually do the drawing of the string here - */ + /* + * Actually do the drawing of the string here + */ rxvt_font *font = (*TermWin.fontset)[fid]; if (back == Color_bg) @@ -2257,9 +2202,9 @@ } /* for (col....) */ } /* for (row....) */ -/* - * G: cleanup cursor and display outline cursor if necessary - */ + /* + * G: cleanup cursor and display outline cursor if necessary + */ if (showcursor) { if (TermWin.focus) { srp = &(screen.rend[screen.cur.row + TermWin.saveLines] @@ -2282,14 +2227,15 @@ (unsigned int)(Height2Pixel(1) - TermWin.lineSpace - 1)); } } -/* - * H: cleanup selection - */ + + /* + * H: cleanup selection + */ rxvt_scr_reverse_selection (this); -/* - * I: other general cleanup - */ + /* + * I: other general cleanup + */ if (clearfirst && TermWin.int_bwidth) /* * clear the whole screen height, note that width == 0 is treated @@ -2577,10 +2523,9 @@ void rxvt_term::incr_cb (time_watcher &w) { - w.stop (); selection_wait = Sel_none; - rxvt_print_error("data loss: timeout on INCR selection paste"); + rxvt_print_error ("data loss: timeout on INCR selection paste"); } /*