--- rxvt-unicode/src/screen.C 2008/11/04 14:34:13 1.314 +++ rxvt-unicode/src/screen.C 2008/11/04 15:02:35 1.316 @@ -145,7 +145,7 @@ rend_t rend = l.r[col] & ~RS_baseattrMask; rend = SET_FONT (rend, FONTSET (rend)->find_font (' ')); - // found begin, nuke + // found start, nuke do { l.t[col] = ' '; l.r[col] = rend; @@ -1466,11 +1466,18 @@ line->touch (); line->is_longer (0); + // nuke wide spanning the start + if (line->t[screen.cur.col] == NOCHAR) + scr_kill_char (*line, screen.cur.col); + switch (insdel) { case INSERT: line->l = min (line->l + count, ncol); + if (line->t[screen.cur.col] == NOCHAR) + scr_kill_char (*line, screen.cur.col); + for (int col = ncol - 1; (col - count) >= screen.cur.col; col--) { line->t[col] = line->t[col - count]; @@ -1500,42 +1507,43 @@ selection_check (1); screen.cur.col -= count; + // nuke wide char after the end + if (screen.cur.col + count < ncol && line->t[screen.cur.col + count] == NOCHAR) + scr_kill_char (*line, screen.cur.col + count); + scr_blank_line (*line, screen.cur.col, count, rstyle); break; case DELETE: - { - line->l = max (line->l - count, 0); - - rend_t tr = line->r[ncol - 1] & (RS_fgMask | RS_bgMask | RS_baseattrMask); + line->l = max (line->l - count, 0); - for (int col = screen.cur.col; (col + count) < ncol; col++) - { - line->t[col] = line->t[col + count]; - line->r[col] = line->r[col + count]; - } + // nuke wide char spanning the end + if (screen.cur.col + count < ncol && line->t[screen.cur.col + count] == NOCHAR) + scr_kill_char (*line, screen.cur.col + count); - // nuke wide char at the end - if (line->t[screen.cur.col] == NOCHAR) - scr_kill_char (*line, screen.cur.col); + for (int col = screen.cur.col; (col + count) < ncol; col++) + { + line->t[col] = line->t[col + count]; + line->r[col] = line->r[col + count]; + } - scr_blank_line (*line, ncol - count, count, tr); + scr_blank_line (*line, ncol - count, count, + line->r[ncol - 1] & (RS_fgMask | RS_bgMask | RS_baseattrMask)); - if (selection.op && current_screen == selection.screen - && ROWCOL_IN_ROW_AT_OR_AFTER (selection.beg, screen.cur)) - { - if (selection.end.row != screen.cur.row - || (screen.cur.col >= selection.beg.col - count) - || selection.end.col >= ncol) - CLEAR_SELECTION (); - else - { - /* shift selection */ - selection.beg.col -= count; - selection.mark.col -= count; /* XXX: yes? */ - selection.end.col -= count; - } - } + if (selection.op && current_screen == selection.screen + && ROWCOL_IN_ROW_AT_OR_AFTER (selection.beg, screen.cur)) + { + if (selection.end.row != screen.cur.row + || (screen.cur.col >= selection.beg.col - count) + || selection.end.col >= ncol) + CLEAR_SELECTION (); + else + { + /* shift selection */ + selection.beg.col -= count; + selection.mark.col -= count; /* XXX: yes? */ + selection.end.col -= count; + } } break;