--- rxvt-unicode/src/screen.C 2003/12/18 13:33:03 1.11 +++ rxvt-unicode/src/screen.C 2003/12/26 07:42:23 1.14 @@ -1,7 +1,7 @@ /*--------------------------------*-C-*--------------------------------------* * File: screen.c *---------------------------------------------------------------------------* - * $Id: screen.C,v 1.11 2003/12/18 13:33:03 pcg Exp $ + * $Id: screen.C,v 1.14 2003/12/26 07:42:23 pcg Exp $ * * Copyright (c) 1997-2001 Geoff Wing * @@ -291,7 +291,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); @@ -901,36 +901,27 @@ } 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) + // width 0 characters (e.g. combining chars) are ignored. your problem, really + while (width-- > 0) { - // 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) - { + stp[R->screen.cur.col] = c; + srp[R->screen.cur.col] = rend; - srp[R->screen.cur.col] |= RS_wide; - - 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; + } } if (R->screen.tlen[row] != -1) /* XXX: think about this */ MAX_IT(R->screen.tlen[row], R->screen.cur.col); @@ -1903,7 +1894,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; @@ -1923,7 +1913,6 @@ sizeof(char) * (currmaxcol + 1) * MB_CUR_MAX); } - buffer = buffer; refresh_count = 0; row_offset = TermWin.saveLines - TermWin.view_start; @@ -1942,14 +1931,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 */ @@ -2028,10 +2017,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 +2085,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 +2095,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++) @@ -2173,9 +2162,9 @@ col--; /* went one too far. move back */ count -= i; /* dump any matching trailing chars */ -/* - * Determine the attributes for the string - */ + /* + * Determine the attributes for the string + */ int fid = GET_FONT(rend); fore = GET_FGCOLOR(rend); back = GET_BGCOLOR(rend); @@ -2225,9 +2214,9 @@ } #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 +2246,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 +2271,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