--- rxvt-unicode/src/screen.C 2003/12/18 14:11:47 1.12 +++ rxvt-unicode/src/screen.C 2004/01/16 16:34:56 1.15 @@ -1,7 +1,7 @@ /*--------------------------------*-C-*--------------------------------------* * File: screen.c *---------------------------------------------------------------------------* - * $Id: screen.C,v 1.12 2003/12/18 14:11:47 pcg Exp $ + * $Id: screen.C,v 1.15 2004/01/16 16:34:56 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); @@ -449,8 +449,8 @@ } #endif - delete talloc; - delete ralloc; + delete talloc; talloc = 0; + delete ralloc; ralloc = 0; free (screen.text); free (screen.tlen); @@ -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);