Toss undead former selections faster
authorJack Miller <jack@codezen.org>
Wed, 17 Dec 2014 18:49:37 +0000 (12:49 -0600)
committerJack Miller <jack@codezen.org>
Wed, 17 Dec 2014 18:49:37 +0000 (12:49 -0600)
When preserving the selection, we keep items in the graphical Tag that
are no longer in the TagCore. That's fine, but we need to re-evaluate
that tag next time a sync is requested, despite the fact that the
underlying TagCore may not have changed.

This should make formerly selected items disappear faster.

canto_curses/tag.py

index 3ee93d9..6e31e7e 100644 (file)
@@ -368,10 +368,19 @@ class Tag(PluginHandler, list):
 
             self.tagcore.lock.acquire_read()
 
+            self.tagcore.ack_changes()
+
             for story in self:
                 if story.id in self.tagcore:
                     current_stories.append((self.tagcore.index(story.id), story))
                 elif story == sel:
+
+                    # If we preserve the selection in an "undead" state, then
+                    # we keep set tagcore changed so that the next sync operation
+                    # will re-evaluate it.
+
+                    self.tagcore.changed()
+
                     if current_stories:
                         place = max([ x[0] for x in current_stories ]) + .5
                     else:
@@ -418,5 +427,4 @@ class Tag(PluginHandler, list):
         for s in self:
             s.sync()
 
-        self.tagcore.ack_changes()
         self.updates_pending = 0