]> git.lyx.org Git - lyx.git/blobdiff - src/text2.C
Scons: handle the case when qt4 is in system directories
[lyx.git] / src / text2.C
index d1399ebd911c7315863efe61fed764b2c05462c3..9a9057c39112bad1352a30a498548c37af6350fa 100644 (file)
@@ -915,7 +915,6 @@ pit_type LyXText::getPitNearY(BufferView & bv, int y)
                << endl;
 
        // look for highest numbered paragraph with y coordinate less than given y
-       bool found = false;
        pit_type pit = 0;
        int yy = -1;
        CoordCache::InnerParPosCache::const_iterator it = cc.begin();
@@ -944,8 +943,8 @@ pit_type LyXText::getPitNearY(BufferView & bv, int y)
                && y >= last->second.y_ + int(pars_[last->first].descent())) {
                pit = last->first + 1;
                //  and we are not at the last paragraph in the inset.
-               if (pit == pars_.size())
-                       return it->first;
+               if (pit == int(pars_.size()))
+                       return last->first;
                // then this is the paragraph we are looking for.
                // rebreak it and update the CoordCache.
                redoParagraph(bv, pit);
@@ -1000,6 +999,12 @@ InsetBase * LyXText::editXY(LCursor & cur, int x, int y)
        }
        pit_type pit = getPitNearY(cur.bv(), y);
        BOOST_ASSERT(pit != -1);
+       // When another window is opened with the same document, rows()
+       // will be cleared so pars_[pit].rows() might be empty when switching
+       // between windwos. A better solution is that each buffer view
+       // has its own rows() for the same buffer.
+       if (pars_[pit].rows().empty())
+               redoParagraph(cur.bv(), pit);
        Row const & row = getRowNearY(cur.bv(), y, pit);
        bool bound = false;
 
@@ -1316,6 +1321,8 @@ bool LyXText::deleteEmptyParagraphMechanism(LCursor & cur, LCursor & old)
                    && oldpar.isLineSeparator(old.pos() - 1)
                    && !oldpar.isDeleted(old.pos() - 1)) {
                        oldpar.eraseChar(old.pos() - 1, false); // do not track changes in DEPM
+                       // rebreak it and update the CoordCache.
+                       redoParagraph(cur.bv(), old.pit());
 #ifdef WITH_WARNINGS
 #warning This will not work anymore when we have multiple views of the same buffer
 // In this case, we will have to correct also the cursors held by