There does not appear to be any need to update the entire Buffer

after each entry into mathed. Instead, we just update the TOC for
anything the mathed happens to be inside.
This commit is contained in:
Richard Heck 2015-11-30 17:25:03 -05:00
parent cf64064db7
commit 947aaf7a57
4 changed files with 17 additions and 2 deletions

View File

@ -1303,7 +1303,7 @@ void Cursor::plainInsert(MathAtom const & t)
++pos(); ++pos();
inset().setBuffer(bv_->buffer()); inset().setBuffer(bv_->buffer());
inset().initView(); inset().initView();
forceBufferUpdate(); checkBufferStructure();
} }

View File

@ -226,6 +226,15 @@ CursorSlice const & DocIterator::innerTextSlice() const
} }
DocIterator DocIterator::getInnerText() const
{
DocIterator texted = *this;
while (!texted.inTexted())
texted.pop_back();
return texted;
}
pit_type DocIterator::lastpit() const pit_type DocIterator::lastpit() const
{ {
return inMathed() ? 0 : text()->paragraphs().size() - 1; return inMathed() ? 0 : text()->paragraphs().size() - 1;

View File

@ -167,6 +167,8 @@ public:
Paragraph & innerParagraph() const; Paragraph & innerParagraph() const;
/// return the inner text slice. /// return the inner text slice.
CursorSlice const & innerTextSlice() const; CursorSlice const & innerTextSlice() const;
/// returns a DocIterator for the containing text inset
DocIterator getInnerText() const;
/// the first and last positions of a word at top cursor slice /// the first and last positions of a word at top cursor slice
/// \warning only works within text! /// \warning only works within text!
FontSpan locateWord(word_location const loc) const; FontSpan locateWord(word_location const loc) const;

View File

@ -17,6 +17,7 @@
#include "Buffer.h" #include "Buffer.h"
#include "BufferParams.h" #include "BufferParams.h"
#include "Cursor.h"
#include "FloatList.h" #include "FloatList.h"
#include "FuncRequest.h" #include "FuncRequest.h"
#include "InsetList.h" #include "InsetList.h"
@ -266,8 +267,11 @@ shared_ptr<TocBuilder> TocBackend::builder(string const & type)
// TocItem creation and update should be made in a dedicated function and // TocItem creation and update should be made in a dedicated function and
// updateItem should be rewritten to uniformly update the matching items from // updateItem should be rewritten to uniformly update the matching items from
// all TOCs. // all TOCs.
bool TocBackend::updateItem(DocIterator const & dit) bool TocBackend::updateItem(DocIterator const & dit_in)
{ {
// we need a text
DocIterator dit = dit_in.getInnerText();
if (dit.text()->getTocLevel(dit.pit()) == Layout::NOT_IN_TOC) if (dit.text()->getTocLevel(dit.pit()) == Layout::NOT_IN_TOC)
return false; return false;