]> git.llucax.com Git - software/mutt-debian.git/blob - debian/patches/mutt-patched/sidebar-dotted
Standards-Version upgraded to 3.9.2.0, no changes required
[software/mutt-debian.git] / debian / patches / mutt-patched / sidebar-dotted
1 From: Evgeni Golov <sargentd@die-welt.net>
2 License: 3-BSD
3
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
8    the last dot
9
10 I hope, it's usefull for someone ;)
11
12 --- a/sidebar.c
13 +++ b/sidebar.c
14 @@ -255,14 +255,23 @@
15                         int i;
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++;
20                         }
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;
27 +                                       else
28 +                                               tmp_folder_name++;
29 +                               }
30 +                               else
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);
38                         }
39                 }
40                 printw( "%.*s", SidebarWidth - delim_len + 1,
41 --- a/init.h
42 +++ b/init.h
43 @@ -1981,6 +1981,11 @@
44    ** .pp
45    ** The width of the sidebar.
46    */
47 +  { "sidebar_shortpath", DT_BOOL, R_BOTH, OPTSIDEBARSHORTPATH, 0 },
48 +  /*
49 +  ** .pp
50 +  ** Should the sidebar shorten the path showed.
51 +  */
52    { "pgp_use_gpg_agent", DT_BOOL, R_NONE, OPTUSEGPGAGENT, 0},
53    /*
54    ** .pp
55 --- a/mutt.h
56 +++ b/mutt.h
57 @@ -432,6 +432,7 @@
58    OPTSAVENAME,
59    OPTSCORE,
60    OPTSIDEBAR,
61 +  OPTSIDEBARSHORTPATH,
62    OPTSIGDASHES,
63    OPTSIGONTOP,
64    OPTSORTRE,