From 6715a9969debb9d382bf5aced009340f275fede3 Mon Sep 17 00:00:00 2001 From: Charles Haley Date: Wed, 9 Sep 2020 10:21:42 +0100 Subject: [PATCH] Fix tag browser partition by first letter not working for some categories such as Formats and Identifiers. --- src/calibre/gui2/tag_browser/model.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/calibre/gui2/tag_browser/model.py b/src/calibre/gui2/tag_browser/model.py index 4abb2f0c0a..3b7ad6bd98 100644 --- a/src/calibre/gui2/tag_browser/model.py +++ b/src/calibre/gui2/tag_browser/model.py @@ -529,10 +529,9 @@ class TagsModel(QAbstractItemModel): # {{{ last_ordnum = 0 last_c = ' ' for idx,tag in enumerate(data[key]): - if not tag.sort: - c = ' ' - else: - c = icu_upper(tag.sort) + # Deal with items that don't have sorts, such as formats + t = tag.sort if tag.sort else tag.name + c = ' ' if not t else icu_upper(t) ordnum, ordlen = collation_order(c) if last_ordnum != ordnum: last_c = c[0:ordlen]