diff options
author | Michael Stahl <mstahl@redhat.com> | 2016-09-01 23:06:00 +0200 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2016-09-20 23:05:01 +0200 |
commit | aef5dcde285bfed3feb94488b98f86ed840d49c5 (patch) | |
tree | fc5df300351305c3346c625f144ffca82d4fe34c | |
parent | f2175fafec4a5088c7f746574cbff9b84a8ed870 (diff) |
editeng: don't let wild-card auto-correct leave current word
If a paragraph has e.g. multiple -> in it then auto-correct of the first
one will create via the .*->.* rule a new auto-correct entry that has as
long-word the word that contains the first -> until the last -> and
everything in between. This will be somewhat irritating when it is
eventually applied. Avoid it by limiting the wild-card loop to the
current word, which is apparently the intent anyway.
(regression from a07425892205ff8951027ea20459b97370d01de6)
Change-Id: I294bae863c44eb460627b61b4383133131fe4b3a
Reviewed-on: https://gerrit.libreoffice.org/28608
Reviewed-by: László Németh <nemeth@numbertext.org>
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Michael Stahl <mstahl@redhat.com>
(cherry picked from commit 9670f0d17ffed1ff07cb1deddcabc26c756e4bc1)
Reviewed-on: https://gerrit.libreoffice.org/28634
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
(cherry picked from commit 0c0c421f1936417d72d6268aaeee86d119ae8841)
-rw-r--r-- | editeng/source/misc/svxacorr.cxx | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx index 2ee3fc4a06e6..a34185116677 100644 --- a/editeng/source/misc/svxacorr.cxx +++ b/editeng/source/misc/svxacorr.cxx @@ -2821,6 +2821,11 @@ const SvxAutocorrWord* SvxAutocorrWordList::WordMatches(const SvxAutocorrWord *p nSttWdPos = rTxt.indexOf( sTmp, nFndPos); if (nSttWdPos != -1) { + sal_Int32 nTmp(nFndPos); + while (nTmp < nSttWdPos && !IsWordDelim(rTxt[nTmp])) + nTmp++; + if (nTmp < nSttWdPos) + break; // word delimiter found buf.append(rTxt.copy(nFndPos, nSttWdPos - nFndPos)).append(pFnd->GetLong()); nFndPos = nSttWdPos + sTmp.getLength(); } |