Alfredo Braunstein wrote:

Here's a patch with both changes + some minor cosmetic stuff

Index: text.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/text.C,v
retrieving revision 1.421
diff -u -p -u -r1.421 text.C
--- text.C      15 Aug 2003 15:20:50 -0000      1.421
+++ text.C      15 Aug 2003 22:47:12 -0000
@@ -2150,36 +2150,19 @@ RowList::iterator LyXText::cursorIRow() 
 
 
 RowList::iterator LyXText::getRowNearY(int & y,
-       ParagraphList::iterator & pit) const
+                                      ParagraphList::iterator & pit) const
 {
-       ParagraphList::iterator const end = ownerParagraphs().end();
        //lyxerr << "getRowNearY: y " << y << endl;
-
-       for (pit = ownerParagraphs().begin(); pit != end; ++pit) {
-               RowList::iterator rit = pit->rows.begin();
-               RowList::iterator rend = pit->rows.end();
-
-               for ( ; rit != rend; ++rit) {
-                       //rit->dump();
-                       if (rit->y() >= y) {
-                               if (rit != firstRow())
-                                       previousRow(pit, rit);
-                               y = rit->y();
-                               return rit;
-                       }
-               }
-       }
-
-#if 1
        pit = ownerParagraphs().begin();
-       y = 0;
-       lyxerr << "row not found near " << y << "  pit: " << &*pit << endl;
-       return firstRow();
-#else
-       pit = boost::prior(ownerParagraphs().end());
-       lyxerr << "row not found near " << y << "  pit: " << &*pit << endl;
-       return lastRow();
-#endif
+       RowList::iterator rit = firstRow();
+       RowList::iterator rend = endRow();
+
+       for (; rit != rend; nextRow(pit, rit))
+               if (rit->y() > y)
+                       break;
+       previousRow(pit, rit);
+       y = rit->y();
+       return rit;
 }
 
 
@@ -2208,14 +2191,13 @@ RowList::iterator LyXText::endRow() cons
 
 
 void LyXText::nextRow(ParagraphList::iterator & pit,
-       RowList::iterator & rit) const
+                     RowList::iterator & rit) const
 {
-       if (boost::next(rit) != pit->rows.end()) {
-               rit = boost::next(rit);
-       } else {
+       ++rit;
+       if (rit == pit->rows.end()) {
                ++pit;
                if (pit == ownerParagraphs().end())
-                       rit = boost::next(rit);
+                       --pit;
                else
                        rit = pit->rows.begin();
        }
@@ -2223,10 +2205,10 @@ void LyXText::nextRow(ParagraphList::ite
 
 
 void LyXText::previousRow(ParagraphList::iterator & pit,
-       RowList::iterator & rit) const
+                         RowList::iterator & rit) const
 {
        if (rit != pit->rows.begin())
-               rit = boost::prior(rit);
+               --rit;
        else {
                Assert(pit != ownerParagraphs().begin());
                --pit;

Reply via email to