1 From: Evgeni Golov <sargentd@die-welt.net>
4 When using IMAP, a '.' is often used as a separator instead of '/'.
5 This patch enables mutt to find these dots and
6 1. correctly intend the dir in the sidebar
7 2. if "sidebar_shortpath" is set, shorten the dir to the part after
10 I hope, it's usefull for someone ;)
16 tmp_folder_name = tmp->path + strlen(Maildir);
17 for (i = 0; i < strlen(tmp->path) - strlen(Maildir); i++) {
18 - if (tmp_folder_name[i] == '/') sidebar_folder_depth++;
19 + if (tmp_folder_name[i] == '/' || tmp_folder_name[i] == '.') sidebar_folder_depth++;
21 if (sidebar_folder_depth > 0) {
22 - sidebar_folder_name = malloc(strlen(basename(tmp->path)) + sidebar_folder_depth + 1);
23 + if (option(OPTSIDEBARSHORTPATH)) {
24 + tmp_folder_name = strrchr(tmp->path, '.');
25 + if (tmp_folder_name == NULL)
26 + tmp_folder_name = tmp->path;
31 + tmp_folder_name = tmp->path;
32 + sidebar_folder_name = malloc(strlen(basename(tmp_folder_name)) + sidebar_folder_depth + 1);
33 for (i=0; i < sidebar_folder_depth; i++)
34 sidebar_folder_name[i]=' ';
35 sidebar_folder_name[i]=0;
36 - strncat(sidebar_folder_name, basename(tmp->path), strlen(basename(tmp->path)) + sidebar_folder_depth);
37 + strncat(sidebar_folder_name, basename(tmp_folder_name), strlen(basename(tmp_folder_name)) + sidebar_folder_depth);
40 printw( "%.*s", SidebarWidth - delim_len + 1,
43 @@ -1981,6 +1981,11 @@
45 ** The width of the sidebar.
47 + { "sidebar_shortpath", DT_BOOL, R_BOTH, OPTSIDEBARSHORTPATH, 0 },
50 + ** Should the sidebar shorten the path showed.
52 { "pgp_use_gpg_agent", DT_BOOL, R_NONE, OPTUSEGPGAGENT, 0},
61 + OPTSIDEBARSHORTPATH,
65 --- a/debian/extra/samples/sidebar.muttrc
66 +++ b/debian/extra/samples/sidebar.muttrc
69 # sidebar_delim (string)
70 # Specifies the delimiter between the sidebar and other screens
73 +# sidebar_shortpath (boolean)
74 +# When using IMAP, a '.' is often used as a separator. This option
75 +# allows to shorten the folder name to the part after the last dot.
77 # color sidebar_new [fg] [bg]
78 # The foreground (fg) and background (bg) color of folders that contain new