diff options
author | László Németh <laszlo.nemeth@collabora.com> | 2015-05-25 04:30:16 +0200 |
---|---|---|
committer | László Németh <laszlo.nemeth@collabora.com> | 2015-05-25 05:21:30 +0200 |
commit | 86782d5dfc0163159369677b0ac172ed2125b221 (patch) | |
tree | 9632dd69adaf210405acf0c76e3c641ec3b0c8f7 /editeng | |
parent | b9630867d17c01ec41f6461b1e96288f3932248c (diff) |
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.
Change-Id: I54462d7482838523a47b844da6a84f08a1518b07
Diffstat (limited to 'editeng')
-rw-r--r-- | editeng/source/misc/svxacorr.cxx | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx index 48d12f9ac421..77816d9233eb 100644 --- a/editeng/source/misc/svxacorr.cxx +++ b/editeng/source/misc/svxacorr.cxx @@ -2825,12 +2825,16 @@ 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[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 ] ))) ) { |