]> git.lyx.org Git - lyx.git/blobdiff - src/Cursor.cpp
Fix Cursor::inCoordCache: the root inset is never in the cache
[lyx.git] / src / Cursor.cpp
index c1eb32f684b34876766c5016ee10752821c0b910..8d94ddf5de7e84bc04b9f199b90e59d782287a8b 100644 (file)
@@ -550,8 +550,11 @@ int Cursor::currentMode()
 
 bool Cursor::inCoordCache() const
 {
+       // the root inset is not in cache, but we do not need it.
+       if (depth() == 1)
+               return true;
        CoordCache::Insets const & icache = bv_->coordCache().getInsets();
-       for (size_t i = 0 ; i < depth() ; ++i)
+       for (size_t i = 1 ; i < depth() ; ++i)
                if (!icache.has(&(*this)[i].inset()))
                        return false;
        return true;
@@ -1947,6 +1950,8 @@ bool Cursor::upDownInText(bool up, bool & updateNeeded)
                        // Make sure that cur gets back whatever happened to dummy (Lgb)
                        operator=(dummy);
                }
+               if (inTexted() && pos() && paragraph().isEnvSeparator(pos() - 1))
+                       posBackward();
        } else {
                // if there is a selection, we stay out of any inset,
                // and just jump to the right position: