]> git.lyx.org Git - features.git/commitdiff
Fix bug 2466 by Stefan Schimanski:
authorAbdelrazak Younes <younes@lyx.org>
Thu, 19 Apr 2007 13:37:17 +0000 (13:37 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Thu, 19 Apr 2007 13:37:17 +0000 (13:37 +0000)
If the cursor is currently in macro mode (e.g. the user is typing \fra, but
hasn't finished the command \frac) macros shouldn't be updated.
Another forced screen update is needed if the user leaves macro mode just with
the cursor right key (which doesn't trigger full screen updates itself).

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17860 a592a061-630c-0410-9148-cb99ea01b6c8

src/BufferView.C
src/cursor.C

index ada9cd1171d08a805eb03c8a73aa7088ab7343fb..2c4b7a36b0317d86f295866b16dd9cb2b5751064 100644 (file)
@@ -357,7 +357,8 @@ bool BufferView::update(Update::flags flags)
        LYXERR(Debug::WORKAREA) << "BufferView::update" << std::endl;
 
        // Update macro store
-       buffer_->buildMacros();
+       if (!(cursor().inMathed() && cursor().inMacroMode()))
+               buffer_->buildMacros();
 
        // Now do the first drawing step if needed. This consists on updating
        // the CoordCache in updateMetrics().
index 68a5e8ba4b711b71a8318c30d88dcec008ff4c9e..e1ff22f267cac95e6277b9f5f536935d7f432617 100644 (file)
@@ -899,14 +899,11 @@ bool LCursor::macroModeClose()
        if (s == "\\")
                return false;
 
-       // prevent entering of recursive macros
-       // FIXME: this is only a weak attempt... only prevents immediate
-       // recursion
-       docstring const name = s.substr(1);
-       InsetBase const * macro = innerInsetOfType(InsetBase::MATHMACRO_CODE);
-       if (macro && macro->getInsetName() == name)
-               lyxerr << "can't enter recursive macro" << endl;
+       // trigger updates of macros, at least, if no full
+       // updates take place anyway
+       updateFlags(Update::Force);
 
+       docstring const name = s.substr(1);
        InsetMathNest * const in = inset().asInsetMath()->asNestInset();
        if (in && in->interpretString(*this, s))
                return true;