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

New commits:
commit fcb36a995dde68456b862db8a931b98176f9eca7
Author:     Tamás Zolnai <tamas.zol...@collabora.com>
AuthorDate: Wed Jul 10 12:07:09 2019 +0200
Commit:     Tamás Zolnai <tamas.zol...@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.zol...@collabora.com>
    Tested-by: Tamás Zolnai <tamas.zol...@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);
+        }
 
     }
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to