summaryrefslogtreecommitdiff
path: root/mail/neomutt/files/0001-fix-sidebar-use-abbreviated-path-if-possible.patch
blob: 6e665b590aba95dc9648c5db34f9ce67a29f1008 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
From 96af299e8c8aff16f4c5e400f79d6edc3792eef5 Mon Sep 17 00:00:00 2001
From: Austin Ray <austin@austinray.io>
Date: Tue, 28 Apr 2020 21:00:57 -0400
Subject: [PATCH] fix(sidebar): use abbreviated path if possible

After the refactor in commit d77c704ceb85f34061e1333ab9c8eb5a264a0685,
the sidebar only displays a mailbox's full path/URI except in the case
of 'sidebar_short_path'. The full path/URI is not preferable for end
users.

What broke during the refactor is how the variable 'display' is updated.
It's initialized to a mailbox's full path/URI and only updated if using
'sidebar_short_path'. However, after initialization, an abbreviation is
calculated to remove the 'folder' or protocol.

To resolve this issue, if there's an abbreviation, store it in the
'display' variable.

Fixes #2293
---
 sidebar.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/sidebar.c b/sidebar.c
index 810146e66..bc680000d 100644
--- a/sidebar.c
+++ b/sidebar.c
@@ -1101,6 +1101,10 @@ static void draw_sidebar(struct MuttWindow *win, int num_rows, int num_cols, int
     if (!abbr)
       abbr = abbrev_url(display, m->type);
 
+    // Use the abbreviation if we have one. The full path is not preferable.
+    if (abbr)
+      display = abbr;
+
     const char *last_part = abbr;
     int depth = calc_path_depth(abbr, C_SidebarDelimChars, &last_part);
 
-- 
2.26.2