sw/source/core/txtnode/txtedt.cxx |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

New commits:
commit 2d496c3b1c0912c747bf7a83a4a982fd2dc3a801
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Thu Jul 15 10:08:00 2021 +0100
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Thu Jul 15 11:59:21 2021 +0200

    tdf#119695 only add word to autocomplete suggestions when the cursor leaves 
it
    
    so that incomplete words are not added as autocomplete candidates even
    if they form a legal word. This is similar to what we do for marking
    words is misspelt
    
    Change-Id: Ib6b209b68bbcf51fa24ea5c4d995579acf682e52
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118974
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/sw/source/core/txtnode/txtedt.cxx 
b/sw/source/core/txtnode/txtedt.cxx
index 8913fbd94810..c98946a40113 100644
--- a/sw/source/core/txtnode/txtedt.cxx
+++ b/sw/source/core/txtnode/txtedt.cxx
@@ -1357,7 +1357,11 @@ SwRect SwTextFrame::AutoSpell_(SwTextNode & rNode, 
sal_Int32 nActPos)
                 }
                 else if( bAddAutoCmpl && rACW.GetMinWordLen() <= 
rWord.getLength() )
                 {
-                    rACW.InsertWord( rWord, rDoc );
+                    // tdf#119695 only add the word if the cursor position is 
outside the word
+                    // so that the incomplete words are not added as 
autocomplete candidates
+                    bool bCursorOutsideWord = nActPos > nBegin + nLen || 
nActPos < nBegin;
+                    if (bCursorOutsideWord)
+                        rACW.InsertWord(rWord, rDoc);
                 }
             }
         }
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to