summaryrefslogtreecommitdiff
path: root/editeng
diff options
context:
space:
mode:
authorLászló Németh <laszlo.nemeth@collabora.com>2015-05-31 15:35:03 +0200
committerChristian Lohmaier <lohmaier+LibreOffice@googlemail.com>2015-06-08 10:21:29 +0000
commit15c04e1f567e50aff850a65996c65e6465497710 (patch)
tree994e9935a971a4d52066bd9f63ca517d6a281d39 /editeng
parent396f1f145ab502a2dba269c986f1f8d172f824e7 (diff)
AutoCorrect: fix not immediately replacement of Emoji :short_names:
Cherry-picked from 86782d5dfc0163159369677b0ac172ed2125b221 and cd2ba3124602ad9ee8f5927c385936cc5319808d. [86782d5dfc0163159369677b0ac172ed2125b221: AutoCorrect: direct replacement of keywords surrounded by colons Replacing immediately (without pressing space or enter) and inside words, too. For example, fixing tdf#55292 – complete input method for n-dash, m-dash – is possible now by :--: -> n-dash, :---: -> m-dash AutoCorrect replacements.] cd2ba3124602ad9ee8f5927c385936cc5319808d: unbreak calc again, a fix for the previous commit by Markus Mohrhard] Change-Id: Id7d9411599bec620fa91c246b531d26150f20c6a Reviewed-on: https://gerrit.libreoffice.org/16002 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
Diffstat (limited to 'editeng')
-rw-r--r--editeng/source/misc/svxacorr.cxx9
1 files changed, 7 insertions, 2 deletions
diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx
index 48d12f9ac421..10426e1d9bdb 100644
--- a/editeng/source/misc/svxacorr.cxx
+++ b/editeng/source/misc/svxacorr.cxx
@@ -2825,12 +2825,17 @@ const SvxAutocorrWord* SvxAutocorrWordList::WordMatches(const SvxAutocorrWord *p
sal_Int32 right_wildcard = rChk.endsWith( ".*" ) ? 2 : 0; // "word.*" pattern?
sal_Int32 nSttWdPos = nEndPos;
- if ( nEndPos >= rChk.getLength() - left_wildcard - right_wildcard )
+ // direct replacement of keywords surrounded by colons (for example, ":name:")
+ bool bColonNameColon = rTxt.getLength() > nEndPos &&
+ rTxt[nEndPos] == ':' && rChk[0] == ':' && rChk.endsWith(":");
+ if ( nEndPos + (bColonNameColon ? 1 : 0) >= rChk.getLength() - left_wildcard - right_wildcard )
{
bool bWasWordDelim = false;
sal_Int32 nCalcStt = nEndPos - rChk.getLength() + left_wildcard;
- if( !right_wildcard && ( !nCalcStt || nCalcStt == rStt || left_wildcard ||
+ if (bColonNameColon)
+ nCalcStt++;
+ if( !right_wildcard && ( !nCalcStt || nCalcStt == rStt || left_wildcard || bColonNameColon ||
( nCalcStt < rStt &&
IsWordDelim( rTxt[ nCalcStt - 1 ] ))) )
{