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

Canberk TURAN (via logerrit) logerrit at kemper.freedesktop.org
Thu Feb 27 07:06:50 UTC 2020


 sw/source/core/crsr/swcrsr.cxx |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

New commits:
commit 0aa0fda64057647219954480ac1bab86b0f0e433
Author:     Canberk TURAN <canberkkturann at gmail.com>
AuthorDate: Tue Feb 25 23:55:50 2020 +0300
Commit:     Gülşah Köse <gulsah.kose at collabora.com>
CommitDate: Thu Feb 27 08:06:16 2020 +0100

    tdf#81226: Cursor jumping fixed
    
    Cursor to jump to end of line when pressing the down key
    
    Change-Id: Ib9548d02039a17257ac7ed63221952abb7792590
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89533
    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 96b77d8a8e71..bc4a53f22583 100644
--- a/sw/source/core/crsr/swcrsr.cxx
+++ b/sw/source/core/crsr/swcrsr.cxx
@@ -2024,11 +2024,17 @@ bool SwCursor::UpDown( bool bUp, sal_uInt16 nCnt,
                 }
                 pFrame->GetModelPositionForViewPoint( GetPoint(), aPt, &eTmpState );
             }
-            bRet = !IsSelOvr( SwCursorSelOverFlags::Toggle | SwCursorSelOverFlags::ChangePos );
         }
         else
-            *GetPoint() = aOldPos;
+        {
+            // Jump to beginning or end of line when the cursor at first or last line.
+            SwNode& rNode = GetPoint()->nNode.GetNode();
+            const sal_Int32 nOffset = bUp ? 0 : rNode.GetTextNode()->GetText().getLength();
+            const SwPosition aPos(*GetContentNode(), nOffset);
+            *GetPoint() = aPos;
+        }
 
+        bRet = !IsSelOvr( SwCursorSelOverFlags::Toggle | SwCursorSelOverFlags::ChangePos );
         DoSetBidiLevelUpDown(); // calculate cursor bidi level
     }
     return bRet;


More information about the Libreoffice-commits mailing list