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

Daniel Burrows dburrows@costa.debian.org
Tue, 07 Jun 2005 00:15:50 +0000


Author: dburrows
Date: Tue Jun  7 00:15:48 2005
New Revision: 3339

Modified:
   branches/aptitude-0.3/aptitude/ChangeLog
   branches/aptitude-0.3/aptitude/src/vscreen/vs_button.cc
Log:
Preserve the attributes of button labels when printing them.

Modified: branches/aptitude-0.3/aptitude/ChangeLog
==============================================================================
--- branches/aptitude-0.3/aptitude/ChangeLog	(original)
+++ branches/aptitude-0.3/aptitude/ChangeLog	Tue Jun  7 00:15:48 2005
@@ -1,5 +1,11 @@
 2005-06-06  Daniel Burrows  <dburrows@debian.org>
 
+	* src/vscreen/vs_button.cc:
+
+	Don't drop character attributes from the enclosed text -- this is
+	safe now that we have cascading styles.  This means that button
+	labels can have (for instance) highlighted characters.
+
 	* src/vscreen/vs_minibuf_win.cc:
 
 	Fix the minibuf window to set the basic style of its header and

Modified: branches/aptitude-0.3/aptitude/src/vscreen/vs_button.cc
==============================================================================
--- branches/aptitude-0.3/aptitude/src/vscreen/vs_button.cc	(original)
+++ branches/aptitude-0.3/aptitude/src/vscreen/vs_button.cc	Tue Jun  7 00:15:48 2005
@@ -57,10 +57,13 @@
 void vs_button::paint(const style &st)
 {
   size_t labelw=getmaxx()>=4?getmaxx()-4:0;
-  fragment_contents lines=label->layout(labelw, labelw, st);
 
-  if(get_isfocussed())
-    apply_style(st+style_attrs_flip(A_REVERSE));
+  const style my_style=
+    get_isfocussed()?st+style_attrs_flip(A_REVERSE):st;
+
+  apply_style(my_style);
+
+  fragment_contents lines=label->layout(labelw, labelw, my_style);
 
   // TODO: create a "bracebox" fragment that places left&right braces
   // automatically.
@@ -81,7 +84,7 @@
 
       chstring s=lines[i];
       for(chstring::iterator j=s.begin(); j!=s.end(); ++j)
-	addch((*j)&A_CHARTEXT);
+	addch(*j);
 
       int w=2+s.size();