From ccb3eff05b65d4ee5680ee08a4b7b01f4340b50e Mon Sep 17 00:00:00 2001 From: Adam Victor Nazareth Brandizzi Date: Wed, 31 Jul 2013 22:18:40 -0300 Subject: [PATCH] Fix the issue of renaming user categories to the same name it already has resulting in deletion of the category (see https://bugs.launchpad.net/calibre/+bug/1207131) --- src/calibre/gui2/tag_browser/model.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/calibre/gui2/tag_browser/model.py b/src/calibre/gui2/tag_browser/model.py index 1b291930fd..ea0e5f5f68 100644 --- a/src/calibre/gui2/tag_browser/model.py +++ b/src/calibre/gui2/tag_browser/model.py @@ -971,6 +971,10 @@ class TagsModel(QAbstractItemModel): # {{{ else: nkey = ckey[:dotpos+1] + val nkey_lower = icu_lower(nkey) + + if ckey == nkey: + return True + for c in sorted(user_cats.keys(), key=sort_key): if icu_lower(c).startswith(ckey_lower): if len(c) == len(ckey):