]> Dogcows Code - chaz/openbox/blobdiff - otk/label.cc
only store what we need to in the class
[chaz/openbox] / otk / label.cc
index 751fff3421197c55954ef41404f8b1dc611e8ac1..587e321250300a287153bcbd7fcc080b5814e8a1 100644 (file)
@@ -49,12 +49,20 @@ void Label::setText(const ustring &text)
   std::string s = text.c_str(); // use a normal string, for its functionality
 
   _parsedtext.clear();
+  _text = text;
   
   // parse it into multiple lines
   std::string::size_type p = 0;
   while (p != std::string::npos) {
     std::string::size_type p2 = s.find('\n', p);
-    _parsedtext.push_back(s.substr(p, (p2==std::string::npos?p2:p2-p)));
+    std::string s(s.substr(p, (p2==std::string::npos?p2:p2-p)));
+
+    // turn tabs into spaces (multiples of 8)
+    std::string::size_type t;
+    while ((t = s.find('\t')) != std::string::npos)
+      s.replace(t, 1, std::string(8 - t % 8, ' '));
+
+    _parsedtext.push_back(s);
     _parsedtext.back().setUtf8(utf);
     p = (p2==std::string::npos?p2:p2+1);
   }
This page took 0.019794 seconds and 4 git commands to generate.