[Aptitude-devel] r3113 - in branches/aptitude-0.3/aptitude: . src/vscreen

Daniel Burrows dburrows@costa.debian.org
Wed, 27 Apr 2005 01:34:46 +0000


Author: dburrows
Date: Wed Apr 27 01:34:43 2005
New Revision: 3113

Modified:
   branches/aptitude-0.3/aptitude/ChangeLog
   branches/aptitude-0.3/aptitude/src/vscreen/vs_button.cc
Log:
Fix multi-line pushbuttons.

Modified: branches/aptitude-0.3/aptitude/ChangeLog
==============================================================================
--- branches/aptitude-0.3/aptitude/ChangeLog	(original)
+++ branches/aptitude-0.3/aptitude/ChangeLog	Wed Apr 27 01:34:43 2005
@@ -1,5 +1,9 @@
 2005-04-26  Daniel Burrows  <dburrows@debian.org>
 
+	* src/vscreen/vs_button.cc:
+
+	  Fix multi-line push-buttons.
+
 	* src/vscreen/testvscreen.cc:
 
 	  Test multi-line fragments.

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	Wed Apr 27 01:34:43 2005
@@ -69,42 +69,39 @@
   // automatically.
   for(size_t i=0; i<lines.size(); ++i)
     {
-      std::string out;
+      move(i, 0);
+
       if(lines.size() == 1)
-	out+="[ ";
+	addch('[');
+      else if(i==0)
+	addch(ACS_ULCORNER);
+      else if(i+1==lines.size())
+	addch(ACS_LLCORNER);
       else
-	{
-	  if(i==0)
-	    out+=ACS_ULCORNER;
-	  else if(i+1==lines.size())
-	    out+=ACS_LLCORNER;
-	  else
-	    out+=ACS_VLINE;
+	addch(ACS_VLINE);
 
-	  out+=" ";
-	}
+      addch(' ');
 
       chstring s=lines[i];
       for(chstring::iterator j=s.begin(); j!=s.end(); ++j)
-	out+=(*j)&A_CHARTEXT;
+	addch((*j)&A_CHARTEXT);
 
-      if(lines.size() == 1)
-	out+=" ]";
-      else
-	{
-	  out+=" ";
+      int w=2+s.size();
 
-	  if(i==0)
-	    out+=ACS_URCORNER;
-	  else if(i+1==lines.size())
-	    out+=ACS_LRCORNER;
-	  else
-	    out+=ACS_VLINE;
+      while(w+1<getmaxx())
+	{
+	  ++w;
+	  addch(' ');
 	}
 
-      // FIXME: do this Better[tm]..maybe even make this a container holding
-      // a label like in GTK+??
-      mvaddnstr(0, 0, out.c_str(), out.size());
+      if(lines.size() == 1)
+	addch(']');
+      else if(i==0)
+	addch(ACS_URCORNER);
+      else if(i+1==lines.size())
+	addch(ACS_LRCORNER);
+      else
+	addch(ACS_VLINE);
     }
 }