beginUndoGroup();
+ Inset * nextins = nextInset();
// Is this a function that acts on inset at point?
- if (lyxaction.funcHasFlag(cmd.action(), LyXAction::AtPoint)
- && nextInset()) {
+ if (lyxaction.funcHasFlag(cmd.action(), LyXAction::AtPoint) && nextins) {
disp_.dispatched(true);
disp_.screenUpdate(Update::FitCursor | Update::Force);
FuncRequest tmpcmd = cmd;
LYXERR(Debug::ACTION, "Cursor::dispatch: (AtPoint) cmd: "
<< cmd0 << endl << *this);
- nextInset()->dispatch(*this, tmpcmd);
+ nextins->dispatch(*this, tmpcmd);
if (disp_.dispatched()) {
endUndoGroup();
return;
#include "Cursor.h"
#include "FuncRequest.h"
#include "FuncStatus.h"
+#include "InsetIterator.h"
#include "Lexer.h"
#include "LyX.h"
#include "MetricsInfo.h"
if (buffer().masterParams().track_changes) {
// With change tracking, we insert a new inset and
- // delete the old one
+ // delete the old one.
+ // But we need to make sure that the inset isn't one
+ // that the current author inserted. Otherwise, we might
+ // delete ourselves!
+ InsetIterator it = begin(buffer().inset());
+ InsetIterator const itend = end(buffer().inset());
+ for (; it != itend; ++it) {
+ if (&*it == this)
+ break;
+ }
+ if (it == itend) {
+ LYXERR0("Unable to find inset!");
+ p_.setCmdName(new_name);
+ return;
+ }
+ Paragraph const & ourpara = it.paragraph();
+ pos_type const ourpos = it.pos();
+ Change const & change = ourpara.lookupChange(ourpos);
+ if (change.currentAuthor()) {
+ p_.setCmdName(new_name);
+ return;
+ }
+
+ // OK, so this is not an inset the current author inserted
InsetCommandParams p(p_.code());
p = p_;
p.setCmdName(new_name);