Subject: mutt-patched: Please indent folders in sidebar according to folder 
depth
Package: mutt-patched
Version: 1.5.17+20080114-1~bpo40+1
Severity: wishlist
Tags: patch
X-Debbugs-CC: [EMAIL PROTECTED]

Hi,

I greatly appreciate you packaged mutt with the sidebar patch applied in
Debian package mutt-patched. I would like to suggest following
improvement:

Please indent the folders in the sidebar with spaces according to their
folder depth. I attached a patch which does exactly this.

Up to now it works perfectly here. :-)

Regards
  Micha

-- System Information:
Debian Release: 4.0
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.18-6-686
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8)

Versions of packages mutt-patched depends on:
ii  libc6          2.3.6.ds1-13etch5         GNU C Library: Shared libraries
ii  libgdbm3       1.8.3-3                   GNU dbm database routines (runtime
ii  libgnutls13    1.4.4-3                   the GNU TLS library - runtime libr
ii  libidn11       0.6.5-1                   GNU libidn library, implementation
ii  libncursesw5   5.5-5                     Shared libraries for terminal hand
ii  libsasl2-2     2.1.22.dfsg1-8            Authentication abstraction library
ii  mutt           1.5.17+20080114-1~bpo40+1 text-based mailreader supporting M

mutt-patched recommends no packages.

-- no debconf information
--- sidebar.c	2008-03-12 15:59:39.000000000 +0100
+++ sidebar.c.patched	2008-03-12 15:58:25.000000000 +0100
@@ -128,6 +128,8 @@
 int draw_sidebar(int menu) {
 
 	int lines = option(OPTHELP) ? 1 : 0;
+	int sidebar_folder_depth;
+	char *sidebar_folder_name;
 	BUFFY *tmp;
 #ifndef USE_SLANG_CURSES
         attr_t attrs;
@@ -229,9 +231,28 @@
 			tmp->msg_unread = Context->unread;
 			tmp->msgcount = Context->msgcount;
 		}
+		sidebar_folder_depth = 0;
+		sidebar_folder_name = "<null>"; // ... just in case
+		if ( strlen(tmp->path) > strlen(Maildir) ) {
+			int i;
+			char *tmp_folder_name;
+			tmp_folder_name = tmp->path + strlen(Maildir);
+			for (i = 0; i < strlen(tmp->path) - strlen(Maildir); i++) {
+				if (tmp_folder_name[i] == '/') sidebar_folder_depth++;
+			}
+			if (sidebar_folder_depth > 0) {
+				sidebar_folder_name = malloc(strlen(basename(tmp->path)) + sidebar_folder_depth + 1);
+				for (i=0; i < sidebar_folder_depth; i++)
+					sidebar_folder_name[i]=' ';
+				sidebar_folder_name[i]=0;
+				strncat(sidebar_folder_name, basename(tmp->path), strlen(basename(tmp->path)) + sidebar_folder_depth);
+			}
+		} else sidebar_folder_name = "INBOX";
                 printw( "%.*s", SidebarWidth - delim_len + 1,
-                        make_sidebar_entry(basename(tmp->path), tmp->msgcount,
+                        make_sidebar_entry(sidebar_folder_name, tmp->msgcount,
                         tmp->msg_unread));
+		if (sidebar_folder_depth > 0)
+			free(sidebar_folder_name);
 		lines++;
 	}
 	SETCOLOR(MT_COLOR_NORMAL);

Reply via email to