]> git.lyx.org Git - lyx.git/commitdiff
When we use InPremable styles, we want to write as many versions
authorRichard Heck <rgheck@lyx.org>
Sun, 12 Jun 2016 04:58:33 +0000 (00:58 -0400)
committerRichard Heck <rgheck@lyx.org>
Sun, 12 Jun 2016 04:58:33 +0000 (00:58 -0400)
to the premable as the user enters.

src/LaTeXFeatures.cpp
src/LaTeXFeatures.h
src/Paragraph.cpp

index 3a2e775316167c292de4e795d7bb2058a7ae2ae6..16ec4c19864517ca3e0c76aa66e652ad0b87a86f 100644 (file)
@@ -579,11 +579,12 @@ bool LaTeXFeatures::isAvailable(string const & name)
 }
 
 
-void LaTeXFeatures::addPreambleSnippet(string const & preamble)
+void LaTeXFeatures::addPreambleSnippet(string const & preamble,
+               bool allowdupes)
 {
        SnippetList::const_iterator begin = preamble_snippets_.begin();
        SnippetList::const_iterator end   = preamble_snippets_.end();
-       if (find(begin, end, preamble) == end)
+       if (allowdupes || find(begin, end, preamble) == end)
                preamble_snippets_.push_back(preamble);
 }
 
index 0d417bd9d2a02d9c233b546b25ec78f80fa2dcf9..38273e4fa2f85c42b5c57a80decb9ecac7867f3b 100644 (file)
@@ -88,7 +88,8 @@ public:
        /// Print requirements to lyxerr
        void showStruct() const;
        ///
-       void addPreambleSnippet(std::string const &);
+       void addPreambleSnippet(std::string const & snippet, 
+                               bool allowdupes = false);
        ///
        std::string getPreambleSnippets() const;
        ///
index 0fd673e71efb4dc9a811e59df2191d85a7fc07be..c29ca4cb930110e780b8011b19ef7fea4d77a246 100644 (file)
@@ -1409,7 +1409,7 @@ void Paragraph::Private::validate(LaTeXFeatures & features) const
                                }
                        }
                        string const snippet = to_utf8(ods.str());
-                       features.addPreambleSnippet(snippet);
+                       features.addPreambleSnippet(snippet, true);
                }
        }