]> git.lyx.org Git - features.git/commitdiff
There does not appear to be any need to update the entire Buffer
authorRichard Heck <rgheck@lyx.org>
Mon, 30 Nov 2015 22:25:03 +0000 (17:25 -0500)
committerRichard Heck <rgheck@lyx.org>
Sat, 12 Dec 2015 22:19:33 +0000 (17:19 -0500)
after each entry into mathed. Instead, we just update the TOC for
anything the mathed happens to be inside.

src/Cursor.cpp
src/DocIterator.cpp
src/DocIterator.h
src/TocBackend.cpp

index c1458dc8a7a0cfc757870775cb2095e748ede087..09407a38533661c38a22e9077157bd9a82cfb32b 100644 (file)
@@ -1303,7 +1303,7 @@ void Cursor::plainInsert(MathAtom const & t)
        ++pos();
        inset().setBuffer(bv_->buffer());
        inset().initView();
-       forceBufferUpdate();
+       checkBufferStructure();
 }
 
 
index 352aa3a65e74831d25089ad882cf570d2c7c41b3..a059ad18d2110b52fe88153b65ef4d5669ed288e 100644 (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
 {
        return inMathed() ? 0 : text()->paragraphs().size() - 1;
index 74dd47438ff85609ba5b8917bcadcd20c3a44c17..471f52d4be18079a6638682a540efff7fb99f7fe 100644 (file)
@@ -167,6 +167,8 @@ public:
        Paragraph & innerParagraph() const;
        /// return the inner text slice.
        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
        /// \warning only works within text!
        FontSpan locateWord(word_location const loc) const;
index e47ca9b63066502ff39b1666161afd9c2d18b913..5599e1f362313fc0e01278a7dd6282eb2309545d 100644 (file)
@@ -17,6 +17,7 @@
 
 #include "Buffer.h"
 #include "BufferParams.h"
+#include "Cursor.h"
 #include "FloatList.h"
 #include "FuncRequest.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
 // updateItem should be rewritten to uniformly update the matching items from
 // 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)
                return false;