]> granicus.if.org Git - neomutt/commitdiff
Skip bidi markers in the pager and index. (closes #3827)
authorKevin McCarthy <kevin@8t8.us>
Tue, 3 May 2016 20:21:41 +0000 (13:21 -0700)
committerKevin McCarthy <kevin@8t8.us>
Tue, 3 May 2016 20:21:41 +0000 (13:21 -0700)
Curses and slang don't support them, so there's little point in
showing them or attempting to somehow deal with them.

This patch adds filtering in the pager, and changes the filtering
added in 6e0aca94cdb0 for the index to completely skip the marker.

mbyte.c
pager.c

diff --git a/mbyte.c b/mbyte.c
index 470686c9c25760688e5be297a17db29791887f91..adea5f43ef07b45abde9f68e2047e63f1c519c91 100644 (file)
--- a/mbyte.c
+++ b/mbyte.c
@@ -548,14 +548,12 @@ int mutt_filter_unprintable (char **s)
     }
     if (!IsWPrint (wc))
       wc = '?';
-    /* HACK:
-     * Work around a gnu screen bug. See ticket #3827.
-     * Filter out the RIGHT-TO-LEFT and LEFT-TO-RIGHT bidi marks because
-     * they result in screen corruption.
+    /* Filter out the RIGHT-TO-LEFT and LEFT-TO-RIGHT bidi markers because
+     * they result in screen corruption.   See ticket #3827.
      */
     else if (Charset_is_utf8 &&
              ((wc == (wchar_t)0x200f) || (wc == (wchar_t)0x200e)))
-      wc = '?';
+      continue;
     k2 = wcrtomb (scratch, wc, &mbstate2);
     scratch[k2] = '\0';
     mutt_buffer_addstr (b, scratch);
diff --git a/pager.c b/pager.c
index d47842abfa60b54d919d22fee96168f506ce6efa..3daa5d077803bf1645481a29bb80b3dba1699a14 100644 (file)
--- a/pager.c
+++ b/pager.c
@@ -1146,10 +1146,19 @@ static int format_line (struct line_t **lineInfo, int n, unsigned char *buf,
     if (k == 0)
       k = 1;
 
-    if (Charset_is_utf8 && (wc == 0x200B || wc == 0xFEFF))
+    if (Charset_is_utf8)
     {
+      if (wc == 0x200B || wc == 0xFEFF)
+      {
        dprint (3, (debugfile, "skip zero-width character U+%04X\n", (unsigned short)wc));
        continue;
+      }
+      /* Filter bidi markers, see ticket #3827 */
+      if (wc == (wchar_t)0x200f || wc == (wchar_t)0x200e)
+      {
+       dprint (3, (debugfile, "skip bidi marker U+%04X\n", (unsigned short)wc));
+       continue;
+      }
     }
 
     /* Handle backspace */