summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2021-07-15 10:08:00 +0100
committerCaolán McNamara <caolanm@redhat.com>2021-07-15 11:59:21 +0200
commit2d496c3b1c0912c747bf7a83a4a982fd2dc3a801 (patch)
tree074a3e33bc82a3f30644a8ea380f87d1e93390f4 /sw
parentac42d6d01fcb64e8093d7f7b2833e9f9e3538369 (diff)
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 <caolanm@redhat.com>
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/txtnode/txtedt.cxx6
1 files changed, 5 insertions, 1 deletions
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);
}
}
}