Waiting for two OKs.

Please use this version.

Bo
Index: src/insets/RenderPreview.h
===================================================================
--- src/insets/RenderPreview.h	(revision 18839)
+++ src/insets/RenderPreview.h	(working copy)
@@ -51,6 +51,9 @@
 	RenderPreview(RenderPreview const &, Inset const *);
 	std::auto_ptr<RenderBase> clone(Inset const *) const;
 
+	/// 
+	bool empty() const { return snippet_.empty(); }
+
 	/// Compute the size of the object, returned in dim
 	bool metrics(MetricsInfo &, Dimension & dim) const;
 	///
Index: src/mathed/InsetMathHull.cpp
===================================================================
--- src/mathed/InsetMathHull.cpp	(revision 18839)
+++ src/mathed/InsetMathHull.cpp	(working copy)
@@ -114,7 +114,15 @@
 		return numbered ? "" : "*";
 	}
 
+	docstring const latex_string(InsetMathHull const & inset)
+	{
+		odocstringstream ls;
+		WriteStream wi(ls, false, false);
+		inset.write(wi);
+		return ls.str();
+	}
 
+
 } // end anon namespace
 
 
@@ -276,6 +284,11 @@
 bool InsetMathHull::previewState(BufferView * bv) const
 {
 	if (!editing(bv) && RenderPreview::status() == LyXRC::PREVIEW_ON) {
+		// BUG 1486: preview_ of copied formula is empty
+		if (preview_->empty()) {
+			docstring const snippet = latex_string(*this);
+			preview_->addPreview(snippet, *bv->buffer());
+		}
 		graphics::PreviewImage const * pimage =
 			preview_->getPreviewImage(*bv->buffer());
 		return pimage && pimage->image();
@@ -395,19 +408,7 @@
 }
 
 
-namespace {
 
-docstring const latex_string(InsetMathHull const & inset)
-{
-	odocstringstream ls;
-	WriteStream wi(ls, false, false);
-	inset.write(wi);
-	return ls.str();
-}
-
-} // namespace anon
-
-
 void InsetMathHull::addPreview(graphics::PreviewLoader & ploader) const
 {
 	if (RenderPreview::status() == LyXRC::PREVIEW_ON) {

Reply via email to