From fa190691a8e825d199845120ab23d2f8cde68500 Mon Sep 17 00:00:00 2001 From: Richard Heck Date: Sun, 12 Jun 2016 00:58:33 -0400 Subject: [PATCH] When we use InPremable styles, we want to write as many versions to the premable as the user enters. --- src/LaTeXFeatures.cpp | 5 +++-- src/LaTeXFeatures.h | 3 ++- src/Paragraph.cpp | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/LaTeXFeatures.cpp b/src/LaTeXFeatures.cpp index 3a2e775316..16ec4c1986 100644 --- a/src/LaTeXFeatures.cpp +++ b/src/LaTeXFeatures.cpp @@ -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); } diff --git a/src/LaTeXFeatures.h b/src/LaTeXFeatures.h index 0d417bd9d2..38273e4fa2 100644 --- a/src/LaTeXFeatures.h +++ b/src/LaTeXFeatures.h @@ -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; /// diff --git a/src/Paragraph.cpp b/src/Paragraph.cpp index 0fd673e71e..c29ca4cb93 100644 --- a/src/Paragraph.cpp +++ b/src/Paragraph.cpp @@ -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); } } -- 2.39.2