summaryrefslogtreecommitdiff
path: root/mail/mutt/files/patch-browser.c
blob: 45f206e92ef8c46a5b0be6ca31a058ef7e011bb8 (plain) (blame)
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
Index: browser.c
@@ -80,6 +80,12 @@
   struct folder_file *pa = (struct folder_file *) a;
   struct folder_file *pb = (struct folder_file *) b;
 
+  /* Always keep '..' in first menu position */
+  if (!strncmp(pa->name, "..", 2))
+	  return(-1);
+  if (!strncmp(pb->name, "..", 2))
+	  return(1);
+
   int r = mutt_strcoll (pa->name, pb->name);
 
   return ((BrowserSort & SORT_REVERSE) ? -r : r);
@@ -90,6 +96,12 @@
   struct folder_file *pa = (struct folder_file *) a;
   struct folder_file *pb = (struct folder_file *) b;
 
+  /* Always keep '..' in first menu position */
+  if (!strncmp(pa->name, "..", 2))
+	  return(-1);
+  if (!strncmp(pb->name, "..", 2))
+	  return(1);
+
   int r = pa->mtime - pb->mtime;
 
   return ((BrowserSort & SORT_REVERSE) ? -r : r);
@@ -100,6 +112,12 @@
   struct folder_file *pa = (struct folder_file *) a;
   struct folder_file *pb = (struct folder_file *) b;
 
+  /* Always keep '..' in first menu position */
+  if (!strncmp(pa->name, "..", 2))
+	  return(-1);
+  if (!strncmp(pb->name, "..", 2))
+	  return(1);
+
   int r = pa->size - pb->size;
 
   return ((BrowserSort & SORT_REVERSE) ? -r : r);