commit 95bc273a597401f3ca9a43ed5d2d5db5626ae819
Author: Enrico Forestieri <[email protected]>
Date:   Thu Dec 13 19:39:23 2018 +0100

    Fix display of single-char macro names
    
    Essentially, all characters are allowed in single-char macro names.
    
    Part of #11158.
---
 src/mathed/InsetMathMacro.cpp         |   12 +++++++-----
 src/mathed/InsetMathMacroTemplate.cpp |   12 +++++++-----
 2 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/src/mathed/InsetMathMacro.cpp b/src/mathed/InsetMathMacro.cpp
index 3a8ec4d..6685628 100644
--- a/src/mathed/InsetMathMacro.cpp
+++ b/src/mathed/InsetMathMacro.cpp
@@ -800,11 +800,13 @@ bool InsetMathMacro::validName() const
                return false;*/
 
        // valid characters?
-       for (size_t i = 0; i<n.size(); ++i) {
-               if (!(n[i] >= 'a' && n[i] <= 'z')
-                   && !(n[i] >= 'A' && n[i] <= 'Z')
-                   && n[i] != '*')
-                       return false;
+       if (n.size() > 1) {
+               for (size_t i = 0; i<n.size(); ++i) {
+                       if (!(n[i] >= 'a' && n[i] <= 'z')
+                           && !(n[i] >= 'A' && n[i] <= 'Z')
+                           && n[i] != '*')
+                               return false;
+               }
        }
 
        return true;
diff --git a/src/mathed/InsetMathMacroTemplate.cpp 
b/src/mathed/InsetMathMacroTemplate.cpp
index 8435d48..2dc2b98 100644
--- a/src/mathed/InsetMathMacroTemplate.cpp
+++ b/src/mathed/InsetMathMacroTemplate.cpp
@@ -1292,11 +1292,13 @@ bool InsetMathMacroTemplate::validName() const
                return false;*/
 
        // valid characters?
-       for (size_t i = 0; i < n.size(); ++i) {
-               if (!(n[i] >= 'a' && n[i] <= 'z')
-                   && !(n[i] >= 'A' && n[i] <= 'Z')
-                   && n[i] != '*')
-                       return false;
+       if (n.size() > 1) {
+               for (size_t i = 0; i < n.size(); ++i) {
+                       if (!(n[i] >= 'a' && n[i] <= 'z')
+                           && !(n[i] >= 'A' && n[i] <= 'Z')
+                           && n[i] != '*')
+                               return false;
+               }
        }
 
        return true;

Reply via email to