From eed452077bdcc17975c715c4bc173dad8d637c29 Mon Sep 17 00:00:00 2001 From: Enrico Forestieri Date: Tue, 28 Apr 2015 22:06:58 +0200 Subject: [PATCH] Preserve numbering of previewed math formulas on zoom The preview snippets are cached in a seemingly random order, such that, when regenerating them on zoom, the math previews would be numbered accordingly. Hence, we have to go through the insets to get the correct order. This is a bit slower but unavoidable. --- src/graphics/PreviewLoader.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/graphics/PreviewLoader.cpp b/src/graphics/PreviewLoader.cpp index 6dfec9b438..7d1cb5466c 100644 --- a/src/graphics/PreviewLoader.cpp +++ b/src/graphics/PreviewLoader.cpp @@ -417,12 +417,9 @@ PreviewLoader::Impl::preview(string const & latex_snippet) const font_scaling_factor_ = fs; Cache::const_iterator cit = cache_.begin(); Cache::const_iterator cend = cache_.end(); - while (cit != cend) { - string const snippet = (cit++)->first; - parent_.remove(snippet); - parent_.add(snippet); - } - parent_.startLoading(false); + while (cit != cend) + parent_.remove((cit++)->first); + buffer_.updatePreviews(); } Cache::const_iterator it = cache_.find(latex_snippet); return (it == cache_.end()) ? 0 : it->second.get();