mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-14 04:21:56 +00:00
Better fix for bug #5923. Now the macro name can be freely edited.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@30425 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
7d1b297e7e
commit
0c2902d0c0
@ -386,19 +386,6 @@ void MathData::updateMacros(Cursor * cur, MacroContext const & mc)
|
|||||||
|| macroInset->name_[0] == '_')
|
|| macroInset->name_[0] == '_')
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (macroInset->displayMode() == MathMacro::DISPLAY_UNFOLDED) {
|
|
||||||
docstring const & unfolded_name = macroInset->name();
|
|
||||||
if (unfolded_name != macroInset->name_) {
|
|
||||||
// macro name was changed
|
|
||||||
cur->recordUndoInset();
|
|
||||||
cur->leaveInset(*macroInset);
|
|
||||||
cur->plainErase();
|
|
||||||
cur->insert(MathAtom(new InsetMathUnknown('\\'
|
|
||||||
+ unfolded_name, docstring(), false)));
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// get macro
|
// get macro
|
||||||
macroInset->updateMacro(mc);
|
macroInset->updateMacro(mc);
|
||||||
size_t macroNumArgs = 0;
|
size_t macroNumArgs = 0;
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
#include "InsetMathChar.h"
|
#include "InsetMathChar.h"
|
||||||
#include "MathCompletionList.h"
|
#include "MathCompletionList.h"
|
||||||
#include "MathExtern.h"
|
#include "MathExtern.h"
|
||||||
|
#include "MathFactory.h"
|
||||||
#include "MathStream.h"
|
#include "MathStream.h"
|
||||||
#include "MathSupport.h"
|
#include "MathSupport.h"
|
||||||
|
|
||||||
@ -624,6 +625,22 @@ bool MathMacro::idxLast(Cursor & cur) const
|
|||||||
|
|
||||||
bool MathMacro::notifyCursorLeaves(Cursor const & old, Cursor & cur)
|
bool MathMacro::notifyCursorLeaves(Cursor const & old, Cursor & cur)
|
||||||
{
|
{
|
||||||
|
if (displayMode_ == DISPLAY_UNFOLDED) {
|
||||||
|
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.niceInsert(createInsetMath(unfolded_name));
|
||||||
|
if (left)
|
||||||
|
cur.backwardPos();
|
||||||
|
cur.updateFlags(Update::Force);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
cur.updateFlags(Update::Force);
|
cur.updateFlags(Update::Force);
|
||||||
return InsetMathNest::notifyCursorLeaves(old, cur);
|
return InsetMathNest::notifyCursorLeaves(old, cur);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user