diff options
| author | Tavmjong Bah <tavmjong@free.fr> | 2017-06-07 09:29:09 +0000 |
|---|---|---|
| committer | tavmjong-free <tavmjong@free.fr> | 2017-06-07 09:29:09 +0000 |
| commit | 8b1a5c84ba61d2a356e9e3295958712b78fb1ff2 (patch) | |
| tree | 33affcee1909c2718e95a9ec93c7d829d3ac825c /src/ui/dialog/styledialog.cpp | |
| parent | [Bug #1695873] Ukrainian translation update for 0.93. (diff) | |
| download | inkscape-8b1a5c84ba61d2a356e9e3295958712b78fb1ff2.tar.gz inkscape-8b1a5c84ba61d2a356e9e3295958712b78fb1ff2.zip | |
Strip comments when parsing CSS. Allow no space after an element name if followed by '+', '>', or '~' when entering new selector.
(bzr r15735)
Diffstat (limited to 'src/ui/dialog/styledialog.cpp')
| -rw-r--r-- | src/ui/dialog/styledialog.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/ui/dialog/styledialog.cpp b/src/ui/dialog/styledialog.cpp index 4576671e7..b1bcddd45 100644 --- a/src/ui/dialog/styledialog.cpp +++ b/src/ui/dialog/styledialog.cpp @@ -355,6 +355,12 @@ void StyleDialog::_readStyleElement() // Remove end-of-lines (check it works on Windoze). content.erase(std::remove(content.begin(), content.end(), '\n'), content.end()); + // Remove comments (/* xxx */) + while(content.find("/*") != std::string::npos) { + size_t start = content.find("/*"); + content.erase(start, (content.find("*/", start) - start) +2); + } + // First split into selector/value chunks. // An attempt to use Glib::Regex failed. A C++11 version worked but // reportedly has problems on Windows. Using split_simple() is simpler @@ -787,7 +793,7 @@ void StyleDialog::_addSelector() * set to ".Class1" */ selectorValue = textEditPtr->get_text(); - Glib::ustring firstWord = selectorValue.substr(0, selectorValue.find(" ")); + Glib::ustring firstWord = selectorValue.substr(0, selectorValue.find_first_of(" >+~")); del->set_sensitive(true); |
