diff --git a/src/Undo.cpp b/src/Undo.cpp index 9e00e5b336..f41716647b 100644 --- a/src/Undo.cpp +++ b/src/Undo.cpp @@ -352,6 +352,9 @@ void Undo::Private::recordUndo(UndoKind kind, // next time we'll try again to combine entries if possible undo_finished_ = false; + // If we ran recordUndo, it means that we plan to change the buffer + buffer_.markDirty(); + redostack_.clear(); //lyxerr << "undostack:\n"; //for (size_t i = 0, n = buf.undostack().size(); i != n && i < 6; ++i) @@ -499,7 +502,9 @@ void Undo::endUndoGroup() } } - +// FIXME: remove these convenience functions and make +// Private::recordUndo public as sole interface. The code in the +// convenience functions can move to Cursor.cpp. void Undo::recordUndo(DocIterator const & cur, UndoKind kind) { diff --git a/src/frontends/qt4/GuiApplication.cpp b/src/frontends/qt4/GuiApplication.cpp index 3976826b7b..47b3eaa06c 100644 --- a/src/frontends/qt4/GuiApplication.cpp +++ b/src/frontends/qt4/GuiApplication.cpp @@ -1610,15 +1610,6 @@ void GuiApplication::dispatch(FuncRequest const & cmd, DispatchResult & dr) current_view_->dispatch(cmd, dr); break; } - - // if we executed a mutating lfun, mark the buffer as dirty - Buffer * doc_buffer = (current_view_ && current_view_->documentBufferView()) - ? &(current_view_->documentBufferView()->buffer()) : 0; - if (doc_buffer && theBufferList().isLoaded(doc_buffer) - && flag.enabled() - && !lyxaction.funcHasFlag(action, LyXAction::NoBuffer) - && !lyxaction.funcHasFlag(action, LyXAction::ReadOnly)) - current_view_->currentBufferView()->buffer().markDirty(); } diff --git a/src/lyxfind.cpp b/src/lyxfind.cpp index 4c8846c5eb..98cfb581e6 100644 --- a/src/lyxfind.cpp +++ b/src/lyxfind.cpp @@ -203,8 +203,6 @@ int replaceAll(BufferView * bv, } bv->putSelectionAt(doc_iterator_begin(&buf), 0, false); - if (num) - buf.markDirty(); cur_orig.fixIfBroken(); bv->setCursor(cur_orig); @@ -272,7 +270,6 @@ pair replaceOne(BufferView * bv, docstring searchstr, return pair(false, 0); cap::replaceSelectionWithString(cur, replacestr, forward); - bv->buffer().markDirty(); findOne(bv, searchstr, case_sens, whole, forward, false); return pair(true, 1); @@ -1231,7 +1228,6 @@ static void findAdvReplace(BufferView * bv, FindAndReplaceOptions const & opt, M LYXERR(Debug::FIND, "Replacing by niceInsert()ing latex: '" << repl_latex << "'"); cur.niceInsert(repl_latex); } - bv->buffer().markDirty(); cur.pos() -= repl_buffer.paragraphs().begin()->size(); bv->putSelectionAt(DocIterator(cur), repl_buffer.paragraphs().begin()->size(), !opt.forward); bv->processUpdateFlags(Update::Force);