From: Richard Heck Date: Sat, 7 May 2011 16:45:45 +0000 (+0000) Subject: Backport r38613 for branch, fixing #7532. X-Git-Tag: 2.0.1~346 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=8f7c852b0f1a0d65eea9377ffcfecffdc68b1741;p=features.git Backport r38613 for branch, fixing #7532. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_2_0_X@38615 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/Buffer.h b/src/Buffer.h index fd17ac14f0..bd462e2640 100644 --- a/src/Buffer.h +++ b/src/Buffer.h @@ -530,7 +530,7 @@ public: /// Collect macro definitions in paragraphs void updateMacros() const; /// Iterate through the whole buffer and try to resolve macros - void updateMacroInstances() const; + void updateMacroInstances(UpdateType) const; /// List macro names of this buffer, the parent and the children void listMacroNames(MacroNameSet & macros) const; diff --git a/src/mathed/MathData.cpp b/src/mathed/MathData.cpp index 8a1a58b0a0..8fcf7466e3 100644 --- a/src/mathed/MathData.cpp +++ b/src/mathed/MathData.cpp @@ -252,7 +252,7 @@ void MathData::metrics(MetricsInfo & mi, Dimension & dim) const } Cursor & cur = mi.base.bv->cursor(); - const_cast(this)->updateMacros(&cur, mi.macrocontext); + const_cast(this)->updateMacros(&cur, mi.macrocontext, InternalUpdate); DocIterator const & inlineCompletionPos = mi.base.bv->inlineCompletionPos(); MathData const * inlineCompletionData = 0; @@ -387,7 +387,8 @@ void MathData::updateBuffer(ParIterator const & it, UpdateType utype) } -void MathData::updateMacros(Cursor * cur, MacroContext const & mc) +void MathData::updateMacros(Cursor * cur, MacroContext const & mc, + UpdateType utype) { // If we are editing a macro, we cannot update it immediately, // otherwise wrong undo steps will be recorded (bug 6208). @@ -484,7 +485,7 @@ void MathData::updateMacros(Cursor * cur, MacroContext const & mc) if (inset->asScriptInset()) inset = inset->asScriptInset()->nuc()[0].nucleus(); LASSERT(inset->asMacro(), /**/); - inset->asMacro()->updateRepresentation(); + inset->asMacro()->updateRepresentation(cur, mc, utype); } } diff --git a/src/mathed/MathData.h b/src/mathed/MathData.h index 877ce31970..6f92852a01 100644 --- a/src/mathed/MathData.h +++ b/src/mathed/MathData.h @@ -167,7 +167,7 @@ public: /// attach/detach arguments to macros, updating the cur to /// stay visually at the same position (cur==0 is allowed) - void updateMacros(Cursor * cur, MacroContext const & mc); + void updateMacros(Cursor * cur, MacroContext const & mc, UpdateType); /// void updateBuffer(ParIterator const &, UpdateType); diff --git a/src/mathed/MathMacro.cpp b/src/mathed/MathMacro.cpp index 3d5b8fec62..cd9b757a51 100644 --- a/src/mathed/MathMacro.cpp +++ b/src/mathed/MathMacro.cpp @@ -311,7 +311,8 @@ void MathMacro::updateMacro(MacroContext const & mc) } -void MathMacro::updateRepresentation() +void MathMacro::updateRepresentation(Cursor * cur, MacroContext const & mc, + UpdateType utype) { // known macro? if (macro_ == 0) @@ -342,6 +343,8 @@ void MathMacro::updateRepresentation() } // expanding macro with the values macro_->expand(values, expanded_.cell(0)); + if (utype == OutputUpdate && !expanded_.cell(0).empty()) + expanded_.cell(0).updateMacros(cur, mc, utype); // get definition for list edit mode docstring const & display = macro_->display(); asArray(display.empty() ? macro_->definition() : display, definition_); diff --git a/src/mathed/MathMacro.h b/src/mathed/MathMacro.h index 1e9536321f..b7308562ff 100644 --- a/src/mathed/MathMacro.h +++ b/src/mathed/MathMacro.h @@ -139,7 +139,7 @@ protected: /// update macro definition void updateMacro(MacroContext const & mc); /// check if macro definition changed, argument changed etc. and adapt - void updateRepresentation(); + void updateRepresentation(Cursor * cur, MacroContext const & mc, UpdateType); /// empty macro, put arguments into args, possibly strip arity-attachedArgsNum_ empty ones. /// Includes the optional arguments. void detachArguments(std::vector & args, bool strip); diff --git a/status.20x b/status.20x index 29aceee724..1906d76fe5 100644 --- a/status.20x +++ b/status.20x @@ -28,6 +28,8 @@ What's new except on Windows, where 30 minutes are allowed. This is because the Windows installer may trigger MiKTeX updates that suffer from network latencies. +- Macros that use other macros now output properly to XHTML (bug 7532). + * USER INTERFACE