Hi,

when I'm running mutt in urxvt, sometimes the vertical lines used for
drawing threads are shifted to the right. It seems to happen when
the first character of the wide tab character is removed and the
remaining NOCHARs make the vertical line character before wider. The
problem doesn't show up when urxvt is started with +ptab.

The attached patch adds a wide character support to the
scr_insdel_chars() function which is causing the problem and also
removes incorrect line length calculation in the ERASE command code.

Please consider for inclusion.

Thanks,

-- 
Miroslav Lichvar
Index: screen.C
===================================================================
RCS file: /schmorpforge/rxvt-unicode/src/screen.C,v
retrieving revision 1.311
diff -u -r1.311 screen.C
--- screen.C    15 Oct 2008 14:48:22 -0000      1.311
+++ screen.C    16 Oct 2008 11:53:51 -0000
@@ -1446,6 +1446,7 @@
 {
   int col, row;
   rend_t tr;
+  bool inwide;
 
   want_refresh = 1;
   ZERO_SCROLLBACK ();
@@ -1465,6 +1466,9 @@
   line->touch ();
   line->is_longer (0);
 
+  /* check if the cursor is in a wide character */
+  inwide = screen.cur.col > 0 && line->t[screen.cur.col] == NOCHAR;
+
   switch (insdel)
     {
       case INSERT:
@@ -1491,7 +1495,21 @@
               }
           }
 
-        scr_blank_line (*line, screen.cur.col, count, rstyle);
+        col = screen.cur.col;
+
+        if (inwide)
+          {
+            /* erase both parts of the splitted wide character */
+            do {
+                col--;
+                count++;
+            } while (col > 0 && line->t[col] == NOCHAR);
+
+            while (col + count + 1 < ncol && line->t[col + count] == NOCHAR)
+              count++;
+          }
+
+        scr_blank_line (*line, col, count, rstyle);
         break;
 
       case ERASE:
@@ -1499,8 +1517,20 @@
         selection_check (1);
         screen.cur.col -= count;
 
-        line->l = max (line->l - count, 0);
-        scr_blank_line (*line, screen.cur.col, count, rstyle);
+        col = screen.cur.col;
+
+        if (inwide)
+          /* seek to the beginning of the wide character */
+          do {
+            col--;
+            count++;
+          } while (col > 0 && line->t[col] == NOCHAR);
+
+        /* erase also rest of a wide character at the end */
+        while (col + count + 1 < ncol && line->t[col + count] == NOCHAR)
+          count++;
+
+        scr_blank_line (*line, col, count, rstyle);
         break;
 
       case DELETE:
@@ -1512,6 +1542,26 @@
             line->r[col] = line->r[col + count];
           }
 
+        /* check if wide characters at the beginning or end were damaged
+           and erase them */
+        if (inwide || line->t[screen.cur.col] == NOCHAR)
+          {
+            int len = 0;
+
+            col = screen.cur.col;
+
+            if (inwide)
+              do {
+                col--;
+                len++;
+              } while (col > 0 && line->t[col] == NOCHAR);
+
+            while (col + len + 1 < ncol && line->t[col + len] == NOCHAR)
+              len++;
+
+            scr_blank_line (*line, col, len, rstyle);
+          }
+
         line->l = max (line->l - count, 0);
         scr_blank_line (*line, ncol - count, count, tr);
 
_______________________________________________
rxvt-unicode mailing list
[email protected]
http://lists.schmorp.de/cgi-bin/mailman/listinfo/rxvt-unicode

Reply via email to