From bf5619875f85abec323731c2f9e69275b3fa537f Mon Sep 17 00:00:00 2001 From: root Date: Tue, 4 Nov 2008 15:02:35 +0000 Subject: [PATCH] *** empty log message *** --- Changes | 2 ++ src/screen.C | 57 +++++++++++++++++++++++++--------------------------- 2 files changed, 29 insertions(+), 30 deletions(-) diff --git a/Changes b/Changes index 4d1106f7..9fa7495d 100644 --- a/Changes +++ b/Changes @@ -29,6 +29,8 @@ TODO: cursor over overlays, when focus change? when a window was closed. - do not (wrongly) adjust the virtual line length inside scr_insdel_chars/ERASE (Miroslav Lichvar). + - fix an issue where wide tab characters caused character shifts + when part of them was deleted (tracked down by Miroslav Lichvar). - remove bogus "setuid/setgid security issues" from rxvt.1.pod, they no longer apply. - the urgency hint is now cleared on both focus in and focus out. diff --git a/src/screen.C b/src/screen.C index 0e05a056..6716e413 100644 --- a/src/screen.C +++ b/src/screen.C @@ -145,7 +145,7 @@ rxvt_term::scr_kill_char (line_t &l, int col) const NOTHROW 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,7 +1466,7 @@ rxvt_term::scr_insdel_chars (int count, int insdel) NOTHROW line->touch (); line->is_longer (0); - // nuke wide char at beginning + // nuke wide spanning the start if (line->t[screen.cur.col] == NOCHAR) scr_kill_char (*line, screen.cur.col); @@ -1515,38 +1515,35 @@ rxvt_term::scr_insdel_chars (int count, int insdel) NOTHROW 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; -- 2.34.1