From: Richard Heck Date: Sun, 12 Jun 2016 04:58:33 +0000 (-0400) Subject: When we use InPremable styles, we want to write as many versions X-Git-Tag: 2.2.1~164 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=0e6b63a26225e11c841839ef4c6b941d645ff24e;p=features.git When we use InPremable styles, we want to write as many versions to the premable as the user enters. (cherry picked from commit fa190691a8e825d199845120ab23d2f8cde68500) --- diff --git a/src/LaTeXFeatures.cpp b/src/LaTeXFeatures.cpp index 4fa2c82941..c66d66b3ed 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 a405b6a806..a396794ebd 100644 --- a/src/Paragraph.cpp +++ b/src/Paragraph.cpp @@ -1397,7 +1397,7 @@ void Paragraph::Private::validate(LaTeXFeatures & features) const } } string const snippet = to_utf8(ods.str()); - features.addPreambleSnippet(snippet); + features.addPreambleSnippet(snippet, true); } } diff --git a/status.22x b/status.22x index e68ecf9aef..06bda4a482 100644 --- a/status.22x +++ b/status.22x @@ -37,6 +37,8 @@ What's new * DOCUMENT INPUT/OUTPUT +- InPreamble styles should be written to the premable as many times as the + user requests them, even if it results in duplicate commands. * LYX2LYX