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.
This commit is contained in:
Enrico Forestieri 2015-04-28 22:06:58 +02:00
parent 558451a51d
commit eed452077b

View File

@ -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();