On 16/11/2009 14:27, Enrico Forestieri wrote:
On Mon, Nov 16, 2009 at 09:05:56AM +0100, Abdelrazak Younes wrote:
Modified: lyx-devel/trunk/src/mathed/MathData.cpp
==============================================================================
--- lyx-devel/trunk/src/mathed/MathData.cpp Mon Nov 16 00:53:40 2009
(r32036)
+++ lyx-devel/trunk/src/mathed/MathData.cpp Mon Nov 16 00:54:45 2009
(r32037)
@@ -379,11 +379,18 @@
void MathData::updateMacros(Cursor * cur, MacroContext const& mc)
{
+ // If we are editing a macro, we cannot update it immediately,
+ // as no undo steps will be recorded (bug 6208).
+ InsetMath const * inmath = cur ? cur->inset().asInsetMath() : 0;
+ MathMacro const * inmacro = inmath ? inmath->asMacro() : 0;
+ docstring const edited_name = inmacro ? inmacro->name() : docstring();
+
// go over the array and look for macros
for (size_t i = 0; i< size(); ++i) {
MathMacro * macroInset = operator[](i).nucleus()->asMacro();
macro_inset
This is not my doing and macroInset is used all over the place in MathData.cpp.
Sorry, I just wrote that mechanically...
Modified: lyx-devel/trunk/src/mathed/MathMacro.cpp
==============================================================================
--- lyx-devel/trunk/src/mathed/MathMacro.cpp Mon Nov 16 00:53:40 2009
(r32036)
+++ lyx-devel/trunk/src/mathed/MathMacro.cpp Mon Nov 16 00:54:45 2009
(r32037)
@@ -633,15 +633,16 @@
docstring const& unfolded_name = name();
if (unfolded_name != name_) {
// The macro name was changed
- cur = old;
- bool left = cur.pos() == 0;
- cur.recordUndoInset();
- cur.popForward();
- cur.backspace();
- cur.insert(createInsetMath(unfolded_name,
cur.buffer()));
- if (left)
- cur.backwardPos();
- cur.updateFlags(Update::Force);
+ Cursor insetCur = old;
inset_cursor
Ok, will replace it.
Thank!
Abdel.