>>>>> "Georg" == Georg Baum <[EMAIL PROTECTED]> writes:
>> Stylistic complaints, or LaTeX errors? Georg> The former. "\sum_{}xxx" works fine and gives the same output Georg> as "\sum xxx", but I would not be surprised if that would be Georg> different with other bases than \sum. Since it is visible on screen, I am not too worried about this. >> All my patch does is remove empty cells when notifyCursorLeaves is >> called. If I leave the cell by clicking somewhere else, the method >> is not invoked and the empty subscript remains. But in this case, >> there is a blue rectangle showing the empty superscript, so people >> know about it. Georg> True, but the inset should nevertheless disappear (but it Georg> behaves like this in 1.3, too). Actually, it disappears when I click in another part of the math inset, or if I click anywhere else in the document. What does not work is clicking on another cell of the same inset. We would need a notifyCursorLeavesCell for that. Another thing that is not handled is when using PageDown to leave the inset. I am not sure where this is handled. >> What the patch does is just run doRecordUndo manually and use the >> real cursor as 5th argument. Georg> And it was that simple? Great. That is exactly the behaviour Georg> Martin and me wanted to have some time ago, but did not know Georg> how to implement it. Thanks for the explanation. For example, try this patch on trunk. It contains the undo patch, uses recordUndoInset in DISSOLVE and makes the code generally suck less :) You still have to do 2 undoes, but this is because paste does a recordUndo unconditionally. JMarc
Index: src/undo.C =================================================================== --- src/undo.C (revision 14779) +++ src/undo.C (working copy) @@ -168,6 +168,7 @@ // We stored the full cell here as there is not much to be // gained by storing just 'a few' paragraphs (most if not // all math inset cells have just one paragraph!) + //lyxerr << "undo.array=" << undo.array <<endl; asArray(undo.array, dit.cell()); } else { // Some finer machinery is needed here. @@ -251,7 +252,9 @@ { LCursor c = cur; c.pop(); - recordUndo(c, kind); + Buffer * buf = cur.bv().buffer(); + doRecordUndo(kind, c, c.pit(), c.pit(), cur, + buf->params(), false, buf->undostack()); } Index: src/text3.C =================================================================== --- src/text3.C (revision 14779) +++ src/text3.C (working copy) @@ -79,6 +79,7 @@ using lyx::cap::copySelection; using lyx::cap::cutSelection; +using lyx::cap::pasteParagraphList; using lyx::cap::pasteSelection; using lyx::cap::replaceSelection; @@ -709,39 +710,30 @@ } case LFUN_INSET_DISSOLVE: { - recordUndo(cur); + recordUndoInset(cur); cur.selHandle(false); // save position lyx::pos_type spos = cur.pos(); lyx::pit_type spit = cur.pit(); - bool content = false; - if (cur.lastpit() != 0 || cur.lastpos() != 0) { - setCursor(cur, 0, 0); - cur.resetAnchor(); - cur.pit() = cur.lastpit(); - cur.pos() = cur.lastpos(); - cur.setSelection(); - copySelection(cur); - content = true; - } - cur.popLeft(); - cur.resetAnchor(); - // store cursor offset - if (spit == 0) - spos += cur.pos(); - spit += cur.pit(); - cur.pos()++; - cur.setSelection(); - if (content) { - lyx::cap::replaceSelection(cur); - pasteSelection(cur, bv->buffer()->errorList("Paste"), 0); - cur.clearSelection(); + ParagraphList plist; + if (cur.lastpit() != 0 || cur.lastpos() != 0) + plist = paragraphs(); + cur.popLeft(); + // store cursor offset + if (spit == 0) + spos += cur.pos(); + spit += cur.pit(); + cur.paragraph().erase(cur.pos()); + if (!plist.empty()) { + Buffer * b = bv->buffer(); + pasteParagraphList(cur, plist, b->params().textclass, + b->errorList("Paste")); // restore position cur.pit() = std::min(cur.lastpit(), spit); cur.pos() = std::min(cur.lastpos(), spos); - cur.resetAnchor(); - } else - cutSelection(cur, false, false); + } + cur.clearSelection(); + cur.resetAnchor(); needsUpdate = true; break; }