]> git.lyx.org Git - lyx.git/blobdiff - src/Cursor.cpp
style
[lyx.git] / src / Cursor.cpp
index be32a76bb273ea5954792276f478a06c9f34defd..d43196516365a45b60924b6d1b1bbe470ab6535a 100644 (file)
@@ -1324,7 +1324,8 @@ ostream & operator<<(ostream & os, Cursor const & cur)
                os << "------------------------------- | " << cur.anchor_[i] << "\n";
        }
        os << " selection: " << cur.selection_
-          << " x_target: " << cur.x_target_ << endl;
+          << " x_target: " << cur.x_target_
+          << " boundary: " << cur.boundary() << endl;
        return os;
 }
 
@@ -2106,17 +2107,13 @@ bool Cursor::upDownInText(bool up, bool & updateNeeded)
                                next_row = 0;
                        }
                }
-               top().pos() = min(tm.x2pos(pit(), next_row, xo), top().lastpos());
 
-               int const xpos = tm.x2pos(pit(), next_row, xo);
-               bool const at_end_row = xpos == tm.x2pos(pit(), next_row, tm.width());
-               bool const at_beg_row = xpos == tm.x2pos(pit(), next_row, 0);
-
-               if (at_end_row && at_beg_row)
-                       // make sure the cursor ends up on this row
-                       boundary(false);
-               else
-                       boundary(at_end_row);
+               Row const & real_next_row = tm.parMetrics(pit()).rows()[next_row];
+               bool bound = false;
+               pos_type const col = tm.getColumnNearX(pit(), real_next_row, 
+                                                      xo, bound);
+               top().pos() = real_next_row.pos() + col;
+               boundary(bound);
 
                updateNeeded |= bv().checkDepm(*this, old);
        }