]> git.lyx.org Git - features.git/commitdiff
Fix cache for getInfo() with/without richtext (fixes #8486).
authorJulien Rioux <jrioux@lyx.org>
Tue, 8 Jan 2013 15:20:52 +0000 (16:20 +0100)
committerJulien Rioux <jrioux@lyx.org>
Tue, 8 Jan 2013 15:34:02 +0000 (16:34 +0100)
src/BiblioInfo.cpp
src/BiblioInfo.h

index 4ad119cefd0db38e3e8ff89f6c4a312a16c0efa4..a2989995d2da5a6b82df59eb09ec47c3045065ea 100644 (file)
@@ -577,8 +577,10 @@ docstring BibTeXInfo::expandFormat(string const & format,
 docstring const & BibTeXInfo::getInfo(BibTeXInfo const * const xref,
        Buffer const & buf, bool richtext) const
 {
-       if (!info_.empty())
+       if (!richtext && !info_.empty())
                return info_;
+       if (richtext && !info_richtext_.empty())
+               return info_richtext_;
 
        if (!is_bibtex_) {
                BibTeXInfo::const_iterator it = find(from_ascii("ref"));
@@ -593,8 +595,12 @@ docstring const & BibTeXInfo::getInfo(BibTeXInfo const * const xref,
        info_ = expandFormat(format, xref, counter, buf,
                docstring(), docstring(), docstring(), false);
 
-       if (!info_.empty())
-               info_ = convertLaTeXCommands(info_);
+       if (!info_.empty()) {
+               info_richtext_ = convertLaTeXCommands(processRichtext(info_, true));
+               info_ = convertLaTeXCommands(processRichtext(info_, false));
+               if (richtext)
+                       return info_richtext_;
+       }
        return info_;
 }
 
index 477f0a10e419d7a404ae2c200bdb0b2115dcf08e..0f1b3d8faaf33d476980040f39c14f73f16fa4da 100644 (file)
@@ -147,6 +147,8 @@ private:
        docstring entry_type_;
        /// a cache for getInfo()
        mutable docstring info_;
+       /// a cache for getInfo(richtext = true)
+       mutable docstring info_richtext_;
        ///
        docstring cite_number_;
        ///