Package: mutt-patched
Version: mutt-patched
Severity: normal
Tags: patch

Dear Maintainer,

mutt-sidebar doesn't show folder names properly when using both:

set sidebar_folderindent=yes
set sidebar_shortpath=yes

And the IMAP folder separator is '/' instead of '.'.

The attached patch fixes the issue.



-- System Information:
Debian Release: 8.0
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.16.0-4-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_GB.utf8, LC_CTYPE=en_GB.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
--- sidebar.c.orig	2014-12-18 23:35:50.589683928 +0000
+++ sidebar.c	2014-12-18 23:30:40.680566728 +0000
@@ -313,6 +313,8 @@
 		sidebar_folder_name = option(OPTSIDEBARSHORTPATH) ? mutt_basename(tmp->path) : tmp->path + maildir_is_prefix*(strlen(Maildir));
 		if ( maildir_is_prefix && option(OPTSIDEBARFOLDERINDENT) ) {
 			char *tmp_folder_name;
+			char *tmp_folder_name_dot;
+			char *tmp_folder_name_slash;
 			int i;
 			tmp_folder_name = tmp->path + strlen(Maildir) + 1;
 			for (i = 0; i < strlen(tmp->path) - strlen(Maildir); i++) {
@@ -320,11 +322,15 @@
 			}   
 			if (sidebar_folder_depth > 0) {
  				if (option(OPTSIDEBARSHORTPATH)) {
- 					tmp_folder_name = strrchr(tmp->path, '.');
- 					if (tmp_folder_name == NULL)
+ 					tmp_folder_name_dot = strrchr(tmp->path, '.');
+ 					tmp_folder_name_slash = strrchr(tmp->path, '/');
+
+                                        if (tmp_folder_name_dot == NULL && tmp_folder_name_slash == NULL)
  						tmp_folder_name = mutt_basename(tmp->path);
- 					else
-						tmp_folder_name++;
+                                        else if (tmp_folder_name_dot > tmp_folder_name_slash)
+                                                tmp_folder_name = tmp_folder_name_dot + 1;
+                                        else
+                                                tmp_folder_name = tmp_folder_name_slash + 1;
  				}
  				else
  					tmp_folder_name = tmp->path + strlen(Maildir) + 1;

Reply via email to