[Aptitude-svn-commit] r3892 - in branches/aptitude-0.3/aptitude: . src/vscreen

Daniel Burrows dburrows at costa.debian.org
Wed Aug 17 17:43:32 UTC 2005


Author: dburrows
Date: Wed Aug 17 17:43:29 2005
New Revision: 3892

Modified:
   branches/aptitude-0.3/aptitude/ChangeLog
   branches/aptitude-0.3/aptitude/src/vscreen/vs_tree.cc
Log:
Expand the parents of the new selection before setting it (moved this code to
set_selection for better safety).

Modified: branches/aptitude-0.3/aptitude/ChangeLog
==============================================================================
--- branches/aptitude-0.3/aptitude/ChangeLog	(original)
+++ branches/aptitude-0.3/aptitude/ChangeLog	Wed Aug 17 17:43:29 2005
@@ -1,5 +1,10 @@
 2005-08-17  Daniel Burrows  <dburrows at debian.org>
 
+	* src/vscreen/vs_tree.cc:
+
+	  When directly setting the selection to a new tree location, make
+	  sure to expand the parents of the new selection first.
+
 	* src/menu_redirect.h, src/pkg_tree.cc, src/pkg_tree.h, src/pkg_view.cc, src/ui.cc, src/ui.h, src/vscreen/vscreen.cc:
 
 	  Add UI hooks to support reverse searching.

Modified: branches/aptitude-0.3/aptitude/src/vscreen/vs_tree.cc
==============================================================================
--- branches/aptitude-0.3/aptitude/src/vscreen/vs_tree.cc	(original)
+++ branches/aptitude-0.3/aptitude/src/vscreen/vs_tree.cc	Wed Aug 17 17:43:29 2005
@@ -195,7 +195,8 @@
       return j;
   } while(i!=begin);
 
-  assert(0);
+  // Only happens if the iterator isn't in the visible range at all.
+  abort();
 }
 
 bool vs_tree::item_visible(vs_treeiterator pkg)
@@ -219,6 +220,18 @@
 
 void vs_tree::set_selection(vs_treeiterator to)
 {
+  // Expand all its parents so that it's possible to make it visible.
+  vs_treeiterator curr = to;
+  while(!curr.is_root())
+    {
+      curr = curr.get_up();
+      curr.expand();
+    }
+
+  // Expand the root as well if necessary.
+  if(curr != to)
+    curr.expand();
+
   if(item_visible(to))
     {
       if(selected!=end)
@@ -730,11 +743,6 @@
   else
     {
       set_selection(curr);
-      while(!curr.is_root())
-	{
-	  curr=curr.get_up();
-	  curr.expand();
-	}
       vscreen_update();
     }
 }
@@ -809,11 +817,6 @@
   else
     {
       set_selection(curr);
-      while(!curr.is_root())
-	{
-	  curr = curr.get_up();
-	  curr.expand();
-	}
       vscreen_update();
     }
 }



More information about the Aptitude-svn-commit mailing list