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

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Wed Dec 23 13:59:36 UTC 2020


 sw/source/uibase/inc/inputwin.hxx |    8 ++++++++
 1 file changed, 8 insertions(+)

New commits:
commit 3870ca340537294fd1168abe9592f903140d6459
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Dec 22 14:14:39 2020 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Wed Dec 23 14:58:55 2020 +0100

    tdf#138457 Cursor position wrong when using functions in a writer table
    
    Change-Id: I70156d8492afbab2c5993e1627a024ef8e07c492
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108195
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sw/source/uibase/inc/inputwin.hxx b/sw/source/uibase/inc/inputwin.hxx
index 08dcea729fce..ab18e2118cc3 100644
--- a/sw/source/uibase/inc/inputwin.hxx
+++ b/sw/source/uibase/inc/inputwin.hxx
@@ -74,7 +74,15 @@ public:
 
     void replace_selection(const OUString& rText)
     {
+        int nStartPos, nEndPos;
+        m_xWidget->get_selection_bounds(nStartPos, nEndPos);
+        if (nStartPos > nEndPos)
+            std::swap(nStartPos, nEndPos);
+
         m_xWidget->replace_selection(rText);
+
+        nStartPos = nStartPos + rText.getLength();
+        m_xWidget->select_region(nStartPos, nStartPos);
     }
 
     void select_region(int nStartPos, int nEndPos)


More information about the Libreoffice-commits mailing list