mail[Wesnoth-commits] r40068 - in /trunk: data/scenario-test.cfg src/gui/dialogs/wml_message.cpp


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by guillaume . melquiond on December 05, 2009 - 11:47:
Author: silene
Date: Sat Dec  5 11:47:57 2009
New Revision: 40068

URL: http://svn.gna.org/viewcvs/wesnoth?rev=40068&view=rev
Log:
Prevented conflicts between Pango and column stops by ignoring '=' inside 
markup. Fixed bug #14825 along the way.

Modified:
    trunk/data/scenario-test.cfg
    trunk/src/gui/dialogs/wml_message.cpp

Modified: trunk/data/scenario-test.cfg
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/data/scenario-test.cfg?rev=40068&r1=40067&r2=40068&view=diff
==============================================================================
--- trunk/data/scenario-test.cfg (original)
+++ trunk/data/scenario-test.cfg Sat Dec  5 11:47:57 2009
@@ -745,7 +745,7 @@
                 message="*&items/potion-blue.png=Nice blue=Surely you'll 
like that one"
             [/option]
             [option]
-                message="&items/potion-yellow.png=Oh noes yellow=Oh I'm sure 
you'll love that one"
+                message="&items/potion-yellow.png=<span color='#ffff00'>Oh 
noes yellow</span>=Oh I'm sure you'll love that one"
             [/option]
             [option]
                 message="&scenery/well.png=A nice well=Grab a bucket and 
fetch some water."

Modified: trunk/src/gui/dialogs/wml_message.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/dialogs/wml_message.cpp?rev=40068&r1=40067&r2=40068&view=diff
==============================================================================
--- trunk/src/gui/dialogs/wml_message.cpp (original)
+++ trunk/src/gui/dialogs/wml_message.cpp Sat Dec  5 11:47:57 2009
@@ -118,10 +118,28 @@
                        }
 
                        // Handle the special case with an image.
-                       std::string::size_type pos = label.find("=");
-                       if (pos != std::string::npos && label[0] == '&') {
-                               icon = label.substr(1, pos - 1);
+                       std::string::size_type pos = label.find('=');
+                       if (pos != std::string::npos && (label[0] == '&' || 
pos == 0)) {
+                               if (pos) icon = label.substr(1, pos - 1);
                                label.erase(0, pos + 1);
+                       }
+
+                       // Search for an '=' symbol that is not inside markup.
+                       std::string::size_type prev = 0;
+                       bool open = false;
+                       while ((pos = label.find('=', prev)) != 
std::string::npos) {
+                               for (std::string::size_type i = prev; i != 
pos; ++i) {
+                                       switch (label[i]) {
+                                       case '<': open = true; break;
+                                       case '>': open = false; break;
+                                       }
+                               }
+                               if (!open) break;
+                               prev = pos + 1;
+                       }
+                       if (pos != std::string::npos) {
+                               description = label.substr(pos + 1);
+                               label.erase(pos);
                        }
 
                        // Add the data.




Related Messages


Powered by MHonArc, Updated Sat Dec 05 13:20:05 2009