implement scr_kill_char
authorroot <root>
Tue, 4 Nov 2008 14:25:10 +0000 (14:25 +0000)
committerroot <root>
Tue, 4 Nov 2008 14:25:10 +0000 (14:25 +0000)
src/rxvt.h
src/screen.C

index 0b14b9b138f7ac8100aedf35ac8ed21019a50746..2d0c2fbbc33ceb3cf6c0c6f585c9b2eb580c4171 100644 (file)
@@ -1355,6 +1355,7 @@ struct rxvt_term : zero_initialized, rxvt_vars, rxvt_screen {
   void paste (char *data, unsigned int len) NOTHROW;
   void scr_blank_line (line_t &l, unsigned int col, unsigned int width, rend_t efs) const NOTHROW;
   void scr_blank_screen_mem (line_t &l, rend_t efs) const NOTHROW;
+  void scr_kill_char (line_t &l, int col) const NOTHROW;
   int scr_scroll_text (int row1, int row2, int count) NOTHROW;
   void scr_reset ();
   void scr_release () NOTHROW;
index 3fe37b46f5fb07986d15820433452d7a77663a69..5fddbf932bead15c4f3609e7f892d3661512d719 100644 (file)
@@ -134,6 +134,25 @@ rxvt_term::scr_blank_screen_mem (line_t &l, rend_t efs) const NOTHROW
   l.f = 0;
 }
 
+// nuke a single wide character at the given column
+void
+rxvt_term::scr_kill_char (line_t &l, int col) const NOTHROW
+{
+  // find begin
+  while (col > 0 && l.t[col] == NOCHAR)
+    col--;
+
+  rend_t rend = l.r[col] & ~RS_baseattrMask;
+  rend = SET_FONT (rend, FONTSET (rend)->find_font (' '));
+
+  // found begin, nuke
+  do {
+    l.t[col] = ' ';
+    l.r[col] = rend;
+    col++;
+  } while (col < ncol && l.t[col] == NOCHAR);
+}
+
 /* ------------------------------------------------------------------------- *
  *                          SCREEN INITIALISATION                            *
  * ------------------------------------------------------------------------- */
@@ -882,22 +901,7 @@ rxvt_term::scr_add_lines (const wchar_t *str, int len, int minlines) NOTHROW
                 || (screen.cur.col < ncol - 1
                     && line->t[screen.cur.col + 1] == NOCHAR)
              ))
-            {
-              int col = screen.cur.col;
-
-              // find begin
-              while (col > 0 && line->t[col] == NOCHAR)
-                col--;
-
-              rend_t rend = SET_FONT (line->r[col], FONTSET (line->r[col])->find_font (' '));
-
-              // found begin, nuke
-              do {
-                line->t[col] = ' ';
-                line->r[col] = rend;
-                col++;
-              } while (col < ncol && line->t[col] == NOCHAR);
-            }
+            scr_kill_char (*line, screen.cur.col);
 
           rend_t rend = SET_FONT (rstyle, FONTSET (rstyle)->find_font (c));