[LyX/master] Make paste in ensuremath work as in simple math hulls

Enrico Forestieri forenr at lyx.org
Wed Jan 6 01:12:08 UTC 2021


commit d85710d32e097955484011cbc6afd02f370b499f
Author: Enrico Forestieri <forenr at lyx.org>
Date:   Wed Jan 6 02:07:25 2021 +0100

    Make paste in ensuremath work as in simple math hulls
    
    The ensuremath math inset derives from InsetMathNest, so that only the
    first cell of a grid gets pasted. This patch makes it a fixed 1x1 grid
    inset so that pasting works as in normal simple math hulls, i.e., all
    cells are pasted, one after the other.
    
    Fixes #11617.
---
 src/mathed/InsetMathEnsureMath.cpp |    2 +-
 src/mathed/InsetMathEnsureMath.h   |   21 +++++++++++++++++++--
 2 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/src/mathed/InsetMathEnsureMath.cpp b/src/mathed/InsetMathEnsureMath.cpp
index bef6a90..7f82345 100644
--- a/src/mathed/InsetMathEnsureMath.cpp
+++ b/src/mathed/InsetMathEnsureMath.cpp
@@ -26,7 +26,7 @@
 namespace lyx {
 
 InsetMathEnsureMath::InsetMathEnsureMath(Buffer * buf)
-	: InsetMathNest(buf, 1)
+	: InsetMathGrid(buf, 1, 1)
 {}
 
 
diff --git a/src/mathed/InsetMathEnsureMath.h b/src/mathed/InsetMathEnsureMath.h
index 6d80320..35b05e8 100644
--- a/src/mathed/InsetMathEnsureMath.h
+++ b/src/mathed/InsetMathEnsureMath.h
@@ -13,14 +13,14 @@
 #ifndef MATH_ENSUREMATHINSET_H
 #define MATH_ENSUREMATHINSET_H
 
-#include "InsetMathNest.h"
+#include "InsetMathGrid.h"
 
 
 namespace lyx {
 
 
 /// Inset for ensuring math mode
-class InsetMathEnsureMath : public InsetMathNest {
+class InsetMathEnsureMath : public InsetMathGrid {
 public:
 	explicit InsetMathEnsureMath(Buffer * buf);
 	///
@@ -34,6 +34,23 @@ public:
 	///
 	void drawT(TextPainter & pi, int x, int y) const override;
 	///
+	void addRow(row_type row) override {}
+	///
+	void delRow(row_type row) override {}
+	///
+	void swapRow(row_type row) override {}
+	///
+	void addCol(col_type col) override {}
+	///
+	void delCol(col_type col) override {}
+	///
+	docstring eolString(row_type row, bool fragile, bool latex,
+	                    bool last_eoln) const override
+	{ return docstring(); }
+	///
+	docstring eocString(col_type col, col_type lastcol) const override
+	{ return docstring(); }
+	///
 	void write(TeXMathStream & os) const override;
 	///
 	void mathmlize(MathMLStream &) const override;


More information about the lyx-cvs mailing list