Here's the narrow_tree patch for mutt 1.3.25. Daniel Eisenbud
originally wrote this patch for old versions of Mutt (before 1.0).
Then, this patch wasn't supported any longer. But as I still need
it, I modify it each time it need be, but with the risk of breaking
things...

I've tested it only with my configuration, and I don't know about
specific configurations. Use it at your own risks...

-- 
Vincent Lefèvre <[EMAIL PROTECTED]> - Web: <http://www.vinc17.org/> - 100%
validated HTML - Acorn Risc PC, Yellow Pig 17, Championnat International des
Jeux Mathématiques et Logiques, TETRHEX, etc.
Work: CR INRIA - computer arithmetic / SPACES project at LORIA
diff -ru mutt-1.3.25.old/hdrline.c mutt-1.3.25/hdrline.c
--- mutt-1.3.25.old/hdrline.c   Mon Dec 17 11:04:48 2001
+++ mutt-1.3.25/hdrline.c       Wed Jan  2 01:08:52 2002
@@ -200,6 +200,50 @@
   return h->recipient;
 }
 
+/* do_subject returns the pointer it is given for tree or subject if
+ * the respective one of them is all the subject that needs to be
+ * printed.  otherwise, it copies the appropriate string into buf
+ * and returns that.
+ */
+char *do_subject (char *dest, size_t destlen, char *subject, char *tree, int flags, 
+char *buf, size_t bufsize)
+{
+  char *dst;
+  
+  if (option (OPTNARROWTREE))
+  {
+    dst = buf;
+    
+    while (bufsize > 1)
+    {
+      *dst = *tree;
+      bufsize--;
+      dst++;
+      if (!(*(tree + 1)))
+       break;
+      tree += 2;
+    }
+    if (*(tree - 1) == '\010')
+      *(dst - 2) = '\010';
+    
+    if (flags & M_FORMAT_FORCESUBJ)
+    {
+      mutt_format_s (dest, destlen, "", NONULL (subject));
+      snprintf (dst, bufsize, "%s", dest);
+    }
+    else
+      *dst = 0;
+    return (buf);
+  }
+  else if (flags & M_FORMAT_FORCESUBJ)
+  {
+    mutt_format_s (dest, destlen, "", NONULL (subject));
+    snprintf (buf, bufsize, "%s%s", tree, dest);
+    return (buf);
+  }
+  else
+    return (tree);
+}
+
 /* %a = address of author
  * %b = filename of the originating folder
  * %B = the list to which the letter was sent
@@ -528,16 +572,8 @@
     case 's':
       
       if (flags & M_FORMAT_TREE && !hdr->collapsed)
-      {
-       if (flags & M_FORMAT_FORCESUBJ)
-       {
-         mutt_format_s (dest, destlen, "", NONULL (hdr->env->subject));
-         snprintf (buf2, sizeof (buf2), "%s%s", hdr->tree, dest);
-         mutt_format_s_tree (dest, destlen, prefix, buf2);
-       }
-       else
-         mutt_format_s_tree (dest, destlen, prefix, hdr->tree);
-      }
+       mutt_format_s_tree (dest, destlen, prefix,
+         do_subject (dest, destlen, hdr->env->subject, hdr->tree, flags, buf2, sizeof 
+(buf2)));
       else
        mutt_format_s (dest, destlen, prefix, NONULL (hdr->env->subject));
       break;
diff -ru mutt-1.3.25.old/init.h mutt-1.3.25/init.h
--- mutt-1.3.25.old/init.h      Mon Dec 10 11:09:03 2001
+++ mutt-1.3.25/init.h  Wed Jan  2 01:08:52 2002
@@ -1093,6 +1093,14 @@
   { "msg_format",      DT_SYN,  R_NONE, UL "message_format", 0 },
   /*
   */
+  { "narrow_tree",     DT_BOOL, R_BOTH, OPTNARROWTREE, 0 },
+  /*
+  ** .pp
+  ** This variable controls the width of the thread tree when sorting by
+  ** threads.  When set, it makes the tree approximately twice as narrow,
+  ** to allow more room the tree and message subjects.  This is useful on
+  ** narrow screens.
+  */
   { "pager",           DT_PATH, R_NONE, UL &Pager, UL "builtin" },
   /*
   ** .pp
diff -ru mutt-1.3.25.old/mutt.h mutt-1.3.25/mutt.h
--- mutt-1.3.25.old/mutt.h      Thu Dec 13 13:10:49 2001
+++ mutt-1.3.25/mutt.h  Wed Jan  2 01:08:52 2002
@@ -363,6 +363,7 @@
   OPTMETOO,
   OPTMHPURGE,
   OPTMIMEFORWDECODE,
+  OPTNARROWTREE,
   OPTPAGERSTOP,
   OPTPIPEDECODE,
   OPTPIPESPLIT,

Reply via email to