mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 05:16:21 +00:00
Fix the way that the Buffer gets set on undo.
Previously, we went through the entire Buffer and set it for every single inset. Now we just do it for the insets we pasted.
This commit is contained in:
parent
c19c54dd5b
commit
66e1819ad1
@ -4699,12 +4699,6 @@ void Buffer::bufferErrors(TeXErrors const & terr, ErrorList & errorList) const
|
||||
}
|
||||
|
||||
|
||||
void Buffer::setBuffersForInsets() const
|
||||
{
|
||||
inset().setBuffer(const_cast<Buffer &>(*this));
|
||||
}
|
||||
|
||||
|
||||
void Buffer::updateBuffer(UpdateScope scope, UpdateType utype) const
|
||||
{
|
||||
LBUFERR(!text().paragraphs().empty());
|
||||
|
@ -719,10 +719,6 @@ public:
|
||||
/// return a list of all used branches (also in children)
|
||||
void getUsedBranches(std::list<docstring> &, bool const from_master = false) const;
|
||||
|
||||
/// sets the buffer_ member for every inset in this buffer.
|
||||
// FIXME This really shouldn't be needed, but at the moment it's not
|
||||
// clear how to do it just for the individual pieces we need.
|
||||
void setBuffersForInsets() const;
|
||||
/// Updates screen labels and some other information associated with
|
||||
/// insets and paragraphs. Actually, it's more like a general "recurse
|
||||
/// through the Buffer" routine, that visits all the insets and paragraphs.
|
||||
|
12
src/Undo.cpp
12
src/Undo.cpp
@ -497,6 +497,15 @@ void Undo::Private::doTextUndoOrRedo(CursorData & cur, UndoElementStack & stack,
|
||||
for (; pit != end; ++pit)
|
||||
pit->setInsetOwner(dit.realInset());
|
||||
plist.insert(first, undo.pars->begin(), undo.pars->end());
|
||||
|
||||
// set the buffers for insets we created
|
||||
ParagraphList::iterator fpit = plist.begin();
|
||||
advance(fpit, undo.from);
|
||||
ParagraphList::iterator fend = fpit;
|
||||
advance(fend, undo.pars->size());
|
||||
for (; fpit != fend; ++fpit)
|
||||
fpit->setBuffer(buffer_);
|
||||
|
||||
delete undo.pars;
|
||||
undo.pars = 0;
|
||||
}
|
||||
@ -531,9 +540,6 @@ bool Undo::Private::textUndoOrRedo(CursorData & cur, bool isUndoOperation)
|
||||
const size_t gid = stack.top().group_id;
|
||||
while (!stack.empty() && stack.top().group_id == gid)
|
||||
doTextUndoOrRedo(cur, stack, otherstack);
|
||||
|
||||
// Adapt the new material to current buffer.
|
||||
buffer_.setBuffersForInsets(); // FIXME This shouldn't be here.
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user