On Thu, Jul 09, 2009 at 06:49:25PM +0200, Enrico Forestieri wrote:
> On Thu, Jul 09, 2009 at 05:53:42PM +0200, Enrico Forestieri wrote:
> > On Thu, Jul 09, 2009 at 05:25:02PM +0200, Vincent van Ravesteijn - TNW 
> > wrote:
> > > 
> > > >Better fix for bug #5923. Now the macro name can be freely edited.
> > > 
> > > I was by the way experiencing difficulties with Undo. After pressing
> > > backspace in a macro, there was no way to undo changes before hitting
> > > backspace.
> > > 
> > > Don't know whether that's still a problem.
> > 
> > I was aware of some problem with undo, but wasn't caring much as I was
> > looking for a better fix. I don't see any problem now (famous last words).
> 
> Indeed, I see an issue when *adding* characters to a macro name, as no
> undo information is recorded. However, this is independent of my patch
> and the attached seems to cure it.

Here is the proper patch. The comment was clear, but the implementation
didn't follow it :)

-- 
Enrico
Index: src/mathed/InsetMathNest.cpp
===================================================================
--- src/mathed/InsetMathNest.cpp        (revisione 30424)
+++ src/mathed/InsetMathNest.cpp        (copia locale)
@@ -808,7 +808,7 @@ void InsetMathNest::doDispatch(Cursor & 
                                cur.insert(arg);
                        break;
                }
-               // Don't record undo steps if we are in macro mode and
+               // Don't record undo steps if we are in macro mode and thus
                // cmd.argument is the next character of the macro name.
                // Otherwise we'll get an invalid cursor if we undo after
                // the macro was finished and the macro is a known command,
@@ -817,14 +817,9 @@ void InsetMathNest::doDispatch(Cursor & 
                // InsetMathFrac -> a pos value > 0 is invalid.
                // A side effect is that an undo before the macro is finished
                // undoes the complete macro, not only the last character.
-               if (!cur.inMacroMode()) {
-                       MathMacro const * macro = 0;
-                       if (cur.pos() > 0 && cmd.argument() != "\\")
-                               macro = cur.inset().asInsetMath()->asMacro();
-                       
-                       if (!macro)
-                               cur.recordUndoSelection();
-               }
+               // At the time we hit '\' we are not in macro mode, still.
+               if (!cur.inMacroMode())
+                       cur.recordUndoSelection();
 
                // spacial handling of space. If we insert an inset
                // via macro mode, we want to put the cursor inside it

Reply via email to