diff --git a/code/nel/src/gui/css_parser.cpp b/code/nel/src/gui/css_parser.cpp index e59cf832b..444b24460 100644 --- a/code/nel/src/gui/css_parser.cpp +++ b/code/nel/src/gui/css_parser.cpp @@ -38,21 +38,57 @@ namespace NLGUI TStyleVec CCssParser::parseDecls(const std::string &styleString) { TStyleVec styles; - std::vector elements; - NLMISC::splitString(styleString, ";", elements); - - for(uint i = 0; i < elements.size(); ++i) + size_t pos = 0; + size_t end = styleString.size(); + while(pos < end) { - std::string::size_type pos; - pos = elements[i].find_first_of(':'); - if (pos != std::string::npos) + size_t sep = styleString.find(':', pos); + if (sep == std::string::npos) + break; + + size_t keyIndex = pos; + size_t keyLength = sep - pos; + + sep++; + pos = sep; + while(sep < end) { - std::string key = trim(toLower(elements[i].substr(0, pos))); - std::string value = trim(elements[i].substr(pos+1)); - styles.push_back(TStylePair(key, value)); + sep = styleString.find_first_of(";'\"(", sep); + if (sep == std::string::npos || styleString[sep] == ';') + break; + + if (styleString[sep] == '\'' || styleString[sep] == '"') + { + char ch = styleString[sep]; + // skip open quote + sep++; + while(sep < end && styleString[sep] != ch) + { + if (styleString[sep] == '\\') + sep++; + sep++; + } + // skip close quote + sep++; + } + else if (styleString[sep] == '(') + { + while(sep < end && styleString[sep] != ')') + { + sep++; + } + // skip close parenthesis + sep++; + } } - } + styles.push_back(TStylePair(trim(styleString.substr(keyIndex, keyLength)), trim(styleString.substr(pos, sep - pos)))); + + if (sep >= end) + break; + + pos = sep + 1; + } return styles; } diff --git a/code/nel/src/gui/css_style.cpp b/code/nel/src/gui/css_style.cpp index 396bff062..267693e06 100644 --- a/code/nel/src/gui/css_style.cpp +++ b/code/nel/src/gui/css_style.cpp @@ -1028,6 +1028,9 @@ namespace NLGUI // second loop -> false && break loop = !loop; + if (next >= parts.size()) + break; + val = toLower(parts[next]); if (val == "center") { diff --git a/code/ryzom/client/src/connection.cpp b/code/ryzom/client/src/connection.cpp index b4d7b5296..f57238991 100644 --- a/code/ryzom/client/src/connection.cpp +++ b/code/ryzom/client/src/connection.cpp @@ -1113,7 +1113,7 @@ TInterfaceState globalMenu() charSelect = LoginCharsel; WaitServerAnswer = false; - if (charSelect == -1) + if (charSelect == -1 || FarTP.isReselectingChar()) { CCDBNodeLeaf *pNL = NLGUI::CDBManager::getInstance()->getDbProp("UI:SERVER_RECEIVED_CHARS", false); if (pNL != NULL) diff --git a/code/ryzom/client/src/interface_v3/chat_text_manager.cpp b/code/ryzom/client/src/interface_v3/chat_text_manager.cpp index 5a2955722..e2dbdcd9c 100644 --- a/code/ryzom/client/src/interface_v3/chat_text_manager.cpp +++ b/code/ryzom/client/src/interface_v3/chat_text_manager.cpp @@ -424,6 +424,10 @@ CViewBase *CChatTextManager::createMsgTextComplex(const ucstring &msg, NLMISC::C ucstring::size_type pos = 0; + // Manage Translations + CCDBNodeLeaf *node= NLGUI::CDBManager::getInstance()->getDbProp("UI:SAVE:CHAT:SHOW_TRANSLATION_ONLY_AS_TOOLTIP_CB", false); + bool originalFirst = node ? node->getValueBool() : true; + string::size_type startTr = msg.find(ucstring("{:")); string::size_type endOfOriginal = msg.find(ucstring("}@{"));