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

Daniel Burrows dburrows@costa.debian.org
Tue, 10 May 2005 13:17:14 +0000


Author: dburrows
Date: Tue May 10 13:17:12 2005
New Revision: 3281

Modified:
   branches/aptitude-0.3/aptitude/ChangeLog
   branches/aptitude-0.3/aptitude/src/vscreen/fragment_cache.cc
   branches/aptitude-0.3/aptitude/src/vscreen/fragment_cache.h
Log:
Make fragment_cache compile (update it to the new protocol).

Modified: branches/aptitude-0.3/aptitude/ChangeLog
==============================================================================
--- branches/aptitude-0.3/aptitude/ChangeLog	(original)
+++ branches/aptitude-0.3/aptitude/ChangeLog	Tue May 10 13:17:12 2005
@@ -1,5 +1,12 @@
 2005-05-10  Daniel Burrows  <dburrows@debian.org>
 
+	* src/vscreen/fragment_cache.cc:
+
+	Fix the compilation errors in fragment_cache.  Note: the cache now
+	updates itself based on its last known style; would it make any
+	sense to keep a map of styles for fragments whose formatting
+	changes?
+
 	* src/vscreen/config/style.h:
 
 	Write operator== and operator!=.

Modified: branches/aptitude-0.3/aptitude/src/vscreen/fragment_cache.cc
==============================================================================
--- branches/aptitude-0.3/aptitude/src/vscreen/fragment_cache.cc	(original)
+++ branches/aptitude-0.3/aptitude/src/vscreen/fragment_cache.cc	Tue May 10 13:17:12 2005
@@ -37,28 +37,24 @@
   cached_trailing_width_valid=cached_final_nl=false;
 }
 
-fragment_contents fragment_cache::layout(size_t firstw, size_t restw)
+fragment_contents fragment_cache::layout(size_t firstw, size_t restw,
+					 const style &st)
 {
   if(!cached_lines_valid ||
      cached_lines_first_width != firstw ||
-     cached_lines_rest_width != restw)
+     cached_lines_rest_width != restw ||
+     cached_lines_style != st)
     {
-      cached_lines=contents->layout(firstw, restw);
+      cached_lines=contents->layout(firstw, restw, st);
       cached_lines_first_width=firstw;
       cached_lines_rest_width=restw;
+      cached_lines_style=st;
       cached_lines_valid=true;
     }
 
   return cached_lines;
 }
 
-void fragment_cache::set_attr(int attr)
-{
-  contents->set_attr(attr);
-
-  invalidate();
-}
-
 size_t fragment_cache::max_width(size_t first_indent, size_t rest_indent) const
 {
   if(!cached_max_width_valid ||

Modified: branches/aptitude-0.3/aptitude/src/vscreen/fragment_cache.h
==============================================================================
--- branches/aptitude-0.3/aptitude/src/vscreen/fragment_cache.h	(original)
+++ branches/aptitude-0.3/aptitude/src/vscreen/fragment_cache.h	Tue May 10 13:17:12 2005
@@ -36,6 +36,9 @@
   /** The last cached result. */
   mutable fragment_contents cached_lines;
 
+  /** If cached_lines is valid, it was formatted in this style: */
+  mutable style cached_lines_style;
+
   /** If cached_lines is valid, cached_lines was formatted for these
    *  widths.
    */
@@ -66,7 +69,8 @@
 
   void invalidate();
 
-  fragment_contents layout(size_t firstw, size_t restw);
+  fragment_contents layout(size_t firstw, size_t restw,
+			   const style &st);
 
   void set_attr(int attr);