[Libreoffice-commits] core.git: sw/source

Canberk TURAN (via logerrit) logerrit at kemper.freedesktop.org
Fri Mar 6 12:44:35 UTC 2020


 sw/source/core/crsr/swcrsr.cxx |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

New commits:
commit 4c009d523f1017def872f0c69caafd7d1826c263
Author:     Canberk TURAN <canberkkturann at gmail.com>
AuthorDate: Thu Mar 5 00:37:18 2020 +0300
Commit:     Gülşah Köse <gulsah.kose at collabora.com>
CommitDate: Fri Mar 6 13:44:01 2020 +0100

    tdf#131134: Corrects the cursor column while moving with arrow keys.
    
    After cursor jumped to start of first line or end of the last
    line (with up/down arrow keys), when we clicked the arrow keys on
    the same direction again, cursor movement column will be the
    last or first column.
    
    Change-Id: I9137adea14ce3fa7dd516a4e6fac5641df5a556b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90012
    Tested-by: Jenkins
    Reviewed-by: Gülşah Köse <gulsah.kose at collabora.com>

diff --git a/sw/source/core/crsr/swcrsr.cxx b/sw/source/core/crsr/swcrsr.cxx
index bc4a53f22583..049cf9212ede 100644
--- a/sw/source/core/crsr/swcrsr.cxx
+++ b/sw/source/core/crsr/swcrsr.cxx
@@ -53,6 +53,7 @@
 #include <IDocumentMarkAccess.hxx>
 #include <memory>
 #include <comphelper/lok.hxx>
+#include <editsh.hxx>
 
 using namespace ::com::sun::star::i18n;
 
@@ -2031,7 +2032,13 @@ bool SwCursor::UpDown( bool bUp, sal_uInt16 nCnt,
             SwNode& rNode = GetPoint()->nNode.GetNode();
             const sal_Int32 nOffset = bUp ? 0 : rNode.GetTextNode()->GetText().getLength();
             const SwPosition aPos(*GetContentNode(), nOffset);
-            *GetPoint() = aPos;
+
+            //if cursor has already been at start or end of file,
+            //Update cursor to change nUpDownX.
+            if ( aOldPos.nContent.GetIndex() == nOffset )
+                GetDoc()->GetEditShell()->UpdateCursor();
+            else
+                *GetPoint() = aPos; // just give a new position
         }
 
         bRet = !IsSelOvr( SwCursorSelOverFlags::Toggle | SwCursorSelOverFlags::ChangePos );


More information about the Libreoffice-commits mailing list