]> git.lyx.org Git - lyx.git/commitdiff
Five more percent.
authorAndré Pönitz <poenitz@gmx.net>
Sat, 12 Jan 2008 23:08:21 +0000 (23:08 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Sat, 12 Jan 2008 23:08:21 +0000 (23:08 +0000)
I'd really prefer if people would not add unused code to critical
paths..

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22534 a592a061-630c-0410-9148-cb99ea01b6c8

src/DocIterator.cpp
src/DocIterator.h

index 51d21921a0990be19c59106f7823b209b5b3f9f9..f444f42193a1e7c692c332635cd58bb36069ac4b 100644 (file)
@@ -247,24 +247,16 @@ Inset * DocIterator::innerInsetOfType(int code) const
 }
 
 
-void DocIterator::forwardPos(bool ignorecollapsed)
+// This duplicates code above, but is in the critical path.
+// So please think twice before adding stuff
+void DocIterator::forwardPos()
 {
-       //this dog bites his tail
+       // this dog bites his tail
        if (empty()) {
                push_back(CursorSlice(*inset_));
                return;
        }
 
-       Inset * const nextinset = nextInset();
-       // jump over collapsables if they are collapsed
-       // FIXME: the check for asInsetMath() shouldn't be necessary
-       // but math insets do not return a sensible editable() state yet.
-       if (ignorecollapsed && nextinset && (!nextinset->asInsetMath()
-           && nextinset->editable() != Inset::HIGHLY_EDITABLE)) {
-               ++top().pos();
-               return;
-       }
-
        CursorSlice & tip = top();
        //lyxerr << "XXX\n" << *this << endl;
 
@@ -302,6 +294,20 @@ void DocIterator::forwardPos(bool ignorecollapsed)
 }
 
 
+void DocIterator::forwardPosIgnoreCollapsed()
+{
+       Inset * const nextinset = nextInset();
+       // FIXME: the check for asInsetMath() shouldn't be necessary
+       // but math insets do not return a sensible editable() state yet.
+       if (nextinset && !nextinset->asInsetMath()
+           && nextinset->editable() != Inset::HIGHLY_EDITABLE) {
+               ++top().pos();
+               return;
+       }
+       forwardPos();
+}
+
+
 void DocIterator::forwardPar()
 {
        forwardPos();
index 6e730ea685018f6b85116c6adbdffdb07469b39e..e36092af748f1697f4b823d9b217c05022fc517d 100644 (file)
@@ -159,9 +159,14 @@ public:
        //
        /**
         * move on one logical position, descend into nested insets
-        * skip collapsed insets if \p ignorecollapsed is true
+        * including collapsed insets
         */
-       void forwardPos(bool ignorecollapsed = false);
+       void forwardPos();
+       /**
+        * move on one logical position, descend into nested insets
+        * skip collapsed insets
+        */
+       void forwardPosIgnoreCollapsed();
        /// move on one physical character or inset
        void forwardChar();
        /// move on one paragraph