diff options
author | Canberk TURAN <canberkkturann@gmail.com> | 2020-03-05 00:37:18 +0300 |
---|---|---|
committer | Gülşah Köse <gulsah.kose@collabora.com> | 2020-03-06 13:44:01 +0100 |
commit | 4c009d523f1017def872f0c69caafd7d1826c263 (patch) | |
tree | 54d6fb15512a25e150f863c69b644681060cd590 /sw | |
parent | 707d3197b14c018553370f4e1a97f515425f73bc (diff) |
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@collabora.com>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/crsr/swcrsr.cxx | 9 |
1 files changed, 8 insertions, 1 deletions
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 ); |