Fix the last part of #3733:

- In GuiApplication::dispatch, do not call markDirty() for lfuns that are not ReadOnly
- In Undo::Private::recordUndo, call markDirty(). The indicator of dirtyness is now the existence of an undo element.
- In lyxfind, remove several markDirty calls that are not needed anymore.



git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36772 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jean-Marc Lasgouttes 2010-12-08 10:30:45 +00:00
parent 2661b9b22e
commit 3370b1d2fa
3 changed files with 6 additions and 14 deletions

View File

@ -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)
{

View File

@ -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();
}

View File

@ -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<bool, int> replaceOne(BufferView * bv, docstring searchstr,
return pair<bool, int>(false, 0);
cap::replaceSelectionWithString(cur, replacestr, forward);
bv->buffer().markDirty();
findOne(bv, searchstr, case_sens, whole, forward, false);
return pair<bool, int>(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);