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

Tamás Zolnai (via logerrit) logerrit at kemper.freedesktop.org
Fri Jul 12 13:03:16 UTC 2019


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

New commits:
commit fcb36a995dde68456b862db8a931b98176f9eca7
Author:     Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Wed Jul 10 12:07:09 2019 +0200
Commit:     Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Fri Jul 12 15:02:01 2019 +0200

    MSForms: date field: handle replacing empty content
    
    It occurs when the date field is empty and the user trying to
    set a date with the date picker.
    
    Change-Id: I182930258b05071d861c2b326c139c73e2339af9
    Reviewed-on: https://gerrit.libreoffice.org/75461
    Reviewed-by: Tamás Zolnai <tamas.zolnai at collabora.com>
    Tested-by: Tamás Zolnai <tamas.zolnai at collabora.com>

diff --git a/sw/source/core/crsr/bookmrk.cxx b/sw/source/core/crsr/bookmrk.cxx
index 61784376509e..85228b5fc195 100644
--- a/sw/source/core/crsr/bookmrk.cxx
+++ b/sw/source/core/crsr/bookmrk.cxx
@@ -634,12 +634,18 @@ namespace sw { namespace mark
         const sal_Int32 nStart(GetMarkStart().nContent.GetIndex());
         const sal_Int32 nEnd  (GetMarkEnd().nContent.GetIndex());
 
-        if(nStart + 1 < pTextNode->GetText().getLength() && nEnd <= pTextNode->GetText().getLength())
+        if(nStart + 1 < pTextNode->GetText().getLength() && nEnd <= pTextNode->GetText().getLength() &&
+           nEnd > nStart + 2)
         {
             SwPaM aFieldPam(GetMarkStart().nNode, nStart + 1,
                             GetMarkStart().nNode, nEnd - 1);
             m_pDocumentContentOperationsManager->ReplaceRange(aFieldPam, sNewContent, false);
         }
+        else
+        {
+            SwPaM aFieldStartPam(GetMarkStart().nNode, nStart + 1);
+            m_pDocumentContentOperationsManager->InsertString(aFieldStartPam, sNewContent);
+        }
 
     }
 


More information about the Libreoffice-commits mailing list