Here are again two very small patches if you agree.

1. Add \ensuremath to the list of math completions.
2. math-mode inserts \text instead of \mbox when already in math mode.

For the latter, \mbox is meant as a way to switch to text mode, but \text from amstext is more appropriate for this purpose. This forces amstext to be automatically included, but we already include automatically amstext for \textrm, \textit, etc. even though it's not required.

Also, a bug: I noticed that the "Insert regular expression" menu is always visible in master (+qt5) even though it's only useful for Advanced search (afaik). Is this on purpose?


Guillaume
>From efb6b79b4d10d44c1ee6362e58bbac0843472f55 Mon Sep 17 00:00:00 2001
From: gadmm <ga...@free.fr>
Date: Sat, 1 Aug 2015 11:27:35 +0100
Subject: [PATCH] Add \ensuremath to the list of math completions

---
 src/mathed/InsetMathNest.cpp | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/mathed/InsetMathNest.cpp b/src/mathed/InsetMathNest.cpp
index d961bfb..fc476fb 100644
--- a/src/mathed/InsetMathNest.cpp
+++ b/src/mathed/InsetMathNest.cpp
@@ -2197,6 +2197,7 @@ MathCompletionList::MathCompletionList(Cursor const & cur)
 	globals.push_back(from_ascii("\\mathclap"));
 	globals.push_back(from_ascii("\\mathllap"));
 	globals.push_back(from_ascii("\\mathrlap"));
+	globals.push_back(from_ascii("\\ensuremath"));
 	MathWordList const & words = mathedWordList();
 	MathWordList::const_iterator it2;
 	//lyxerr << "Globals completion commands: ";
-- 
2.1.4

>From 1266b57006beff9e44de02aa364bf61d81dec889 Mon Sep 17 00:00:00 2001
From: gadmm <ga...@free.fr>
Date: Sat, 1 Aug 2015 11:18:29 +0100
Subject: [PATCH] math-mode inserts \text instead of \mbox when already in math
 mode

---
 src/mathed/BUGS              | 5 -----
 src/mathed/InsetMathNest.cpp | 2 +-
 2 files changed, 1 insertion(+), 6 deletions(-)

diff --git a/src/mathed/BUGS b/src/mathed/BUGS
index fc6873c..b94eaf1 100644
--- a/src/mathed/BUGS
+++ b/src/mathed/BUGS
@@ -65,11 +65,6 @@ The current macro system is clever, but could be neater. One improvement
 I'd like is to let LyX know about TeX's scoping rules...
 
 
-Yves Bastide:
-
-- use AMS's \text instead of \mbox.  It supports accented characters,
-  among others...  (selected via validate()?)
-
 
 Angus:
 
diff --git a/src/mathed/InsetMathNest.cpp b/src/mathed/InsetMathNest.cpp
index 7f0237f..d961bfb 100644
--- a/src/mathed/InsetMathNest.cpp
+++ b/src/mathed/InsetMathNest.cpp
@@ -1010,7 +1010,7 @@ void InsetMathNest::doDispatch(Cursor & cur, FuncRequest & cmd)
 		if (currentMode() <= Inset::TEXT_MODE)
 			cur.plainInsert(MathAtom(new InsetMathEnsureMath(buffer_)));
 		else
-			cur.plainInsert(MathAtom(new InsetMathBox(buffer_, from_ascii("mbox"))));
+			cur.plainInsert(createInsetMath("text",buffer_));
 		cur.posBackward();
 		cur.pushBackward(*cur.nextInset());
 		cur.niceInsert(save_selection);
-- 
2.1.4

Reply via email to