mu4e: show sort arrows for fields / derived fields

We weren't showing the sort-arrows in all cases; we need to get
calculate the current sortfield, compare that to the current sortfield.
This commit is contained in:
djcb 2015-09-19 12:11:17 +03:00
parent d6ca171e9c
commit 90293f6d98
1 changed files with 43 additions and 40 deletions

View File

@ -735,6 +735,8 @@ after the end of the search results."
(defun mu4e~header-line-format ()
"Get the format for the header line."
(let ((uparrow (if mu4e-use-fancy-chars "" " ^"))
(downarrow (if mu4e-use-fancy-chars "" " V")))
(cons
(make-string
(+ mu4e~mark-fringe-len (floor (fringe-columns 'left t))) ?\s)
@ -744,12 +746,13 @@ after the end of the search results."
(info (cdr (assoc field
(append mu4e-header-info mu4e-header-info-custom))))
(sortable (plist-get info :sortable))
;; if sortable, it is either t (when field is sortable itself) or a symbol (if
;; another field is used for sorting)
(sortfield (when sortable (if (booleanp sortable) field sortable)))
(help (plist-get info :help))
(uparrow (if mu4e-use-fancy-chars "" " ^"))
(downarrow (if mu4e-use-fancy-chars "" " V"))
;; triangle to mark the sorted-by column
(arrow
(when (and sortable (eq (car item) mu4e-headers-sort-field))
(when (and sortable (eq sortfield mu4e-headers-sort-field))
(if (eq mu4e-headers-sort-direction 'descending) downarrow uparrow)))
(name (concat (plist-get info :shortname) arrow))
(map (make-sparse-keymap)))
@ -774,7 +777,7 @@ after the end of the search results."
'mouse-face (when sortable 'highlight)
'keymap (when sortable map)
'field field) " ")))
mu4e-headers-fields)))
mu4e-headers-fields))))
(defvar mu4e-headers-mode-abbrev-table nil)