From 087f72202e9ee166d2ec5eedd12c9c7d48db416b Mon Sep 17 00:00:00 2001 From: Guillaume Munch Date: Mon, 12 Dec 2016 01:51:45 +0100 Subject: [PATCH] Use math class information from lib/symbols for intelligent splitting This was missing for macros defined in lib/symbols. This only affects the equation splitting since global macros are always linearized. This fixes #10107. --- src/mathed/MathMacro.cpp | 15 +++++++++++++++ src/mathed/MathMacro.h | 3 +++ 2 files changed, 18 insertions(+) diff --git a/src/mathed/MathMacro.cpp b/src/mathed/MathMacro.cpp index da22747ed8..89f8200193 100644 --- a/src/mathed/MathMacro.cpp +++ b/src/mathed/MathMacro.cpp @@ -821,6 +821,21 @@ size_t MathMacro::appetite() const } +MathClass MathMacro::mathClass() const +{ + // this only affects intelligent splitting since global macros are always + // linearised. + if (MacroData const * m = macroBackup()) { + if (m->symbol()) { + MathClass mc = string_to_class(d->macroBackup_.symbol()->extra); + if (mc != MC_UNKNOWN) + return mc; + } + } + return MC_ORD; +} + + InsetMath::mode_type MathMacro::currentMode() const { // There is no way to guess the mode of user defined macros, so they are diff --git a/src/mathed/MathMacro.h b/src/mathed/MathMacro.h index 5584dd70a5..6e795237e1 100644 --- a/src/mathed/MathMacro.h +++ b/src/mathed/MathMacro.h @@ -141,6 +141,9 @@ public: size_t appetite() const; /// InsetCode lyxCode() const { return MATH_MACRO_CODE; } + /// This is not used for display; however whether it is mathrel determines + /// how to split equations intelligently. + MathClass mathClass() const; //override protected: friend class MathData; -- 2.39.2