Bennett Helm wrote:
On Mac, at least, I have some arrow navigation problems with today's 1.5svn.

Previously, I reported that pressing down-arrow causes the cursor to jump 2 lines down. That has now been fixed. However, now the cursor seems to "remember" a particular horizontal position when moving up or down in a document when using the arrow keys or page-up/down. That is, if I click the mouse somewhere in the document window (towards the left side, say), I can then move right or left with the arrow keys (or even by adding or deleting text). However, when I then try navigating up or down with the arrow keys (or page-up/down), the horizontal position of the cursor jumps to wherever the cursor started -- wherever I clicked the mouse. Clicking the mouse somewhere else causes this new horizontal position to be "remembered".

This is fixed now.

Abdel.

Author: younes
Date: Wed Jan 10 11:59:18 2007
New Revision: 16638

URL: http://www.lyx.org/trac/changeset/16638
Log:
fix cursor movements.

Modified:
    lyx-devel/trunk/src/BufferView.C
    lyx-devel/trunk/src/text.C
    lyx-devel/trunk/src/text2.C

Modified: lyx-devel/trunk/src/BufferView.C
URL: http://www.lyx.org/trac/file/lyx-devel/trunk/src/BufferView.C?rev=16638
==============================================================================
--- lyx-devel/trunk/src/BufferView.C (original)
+++ lyx-devel/trunk/src/BufferView.C Wed Jan 10 11:59:18 2007
@@ -1238,6 +1238,8 @@
                dit[i].inset().edit(cursor_, true);

        cursor_.setCursor(dit);
+       // remember new position.
+       cursor_.setTargetX();
        cursor_.selection() = false;
 }

@@ -1281,6 +1283,7 @@

        cursor_ = cur;
        cursor_.clearSelection();
+       // remember new position.
        cursor_.setTargetX();
        finishUndo();
        return update;

Modified: lyx-devel/trunk/src/text.C
URL: http://www.lyx.org/trac/file/lyx-devel/trunk/src/text.C?rev=16638
==============================================================================
--- lyx-devel/trunk/src/text.C (original)
+++ lyx-devel/trunk/src/text.C Wed Jan 10 11:59:18 2007
@@ -1724,6 +1724,8 @@
                << endl;

        setCursor(cur, pit, pos, true, bound);
+       // remember new position.
+       cur.setTargetX();
 }



Modified: lyx-devel/trunk/src/text2.C
URL: http://www.lyx.org/trac/file/lyx-devel/trunk/src/text2.C?rev=16638
==============================================================================
--- lyx-devel/trunk/src/text2.C (original)
+++ lyx-devel/trunk/src/text2.C Wed Jan 10 11:59:18 2007
@@ -985,12 +985,15 @@
        ParagraphMetrics const & pm = tm.parMetrics(cur.pit());

        int row;
-       int const x = cur.targetX();
-
        if (cur.pos() && cur.boundary())
                row = pm.pos2row(cur.pos()-1);
        else
                row = pm.pos2row(cur.pos());
+
+       // remember current position only if we are not at the end of a row.
+       if (cur.pos() != pm.rows()[row].endpos())
+               cur.setTargetX();
+       int const x = cur.targetX();

        if (!cur.selection()) {
                int const y = bv_funcs::getPos(cur.bv(), cur, 
cur.boundary()).y_;
@@ -1041,12 +1044,15 @@
        ParagraphMetrics const & pm = tm.parMetrics(cur.pit());

        int row;
-       int const x = cur.targetX();
-
        if (cur.pos() && cur.boundary())
                row = pm.pos2row(cur.pos()-1);
        else
                row = pm.pos2row(cur.pos());
+
+       // remember current position only if we are not at the end of a row.
+       if (cur.pos() != pm.rows()[row].endpos())
+               cur.setTargetX();
+       int const x = cur.targetX();

        if (!cur.selection()) {
                int const y = bv_funcs::getPos(cur.bv(), cur, 
cur.boundary()).y_;



Reply via email to