diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2019-10-07 17:46:36 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2019-10-08 14:30:55 +0200 |
commit | ef2ec07b4113fdadf863352c832af657b5ae205c (patch) | |
tree | 8cf3b8cd14fb3aca94c8c8838223553044cc43e1 /sw/inc | |
parent | cf1b5ae4c5f7c9111a745199ac993742f9007263 (diff) |
tdf#128009: Allow spaces in AutoText suggestions
Currently autotext entries with long names starting with spaces, or
containing spaces after first or second character, would never be
suggested when SvxAutoCorrCfg::IsAutoTextTip() gives true (set in
Tools -> AutoCorrect -> [x] Display remainder of name as suggestion
while typing), because only a single word no less than 3 chars long
left to cursor is considered a candidate for the name matching.
This change allows to consider multiple chunks of text left to the
cursor as the candidates for name matching. The chunks are 3-9
characters long, may start only between words, and have spaces,
including leading. Thus, AutoText entries with long names like
" Dr Foo" will now be suggested for an entry like "lorem dr f".
Change-Id: If91c957341a4f4b281acb0e4ada558706ea2f8c1
Reviewed-on: https://gerrit.libreoffice.org/80392
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sw/inc')
-rw-r--r-- | sw/inc/editsh.hxx | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/sw/inc/editsh.hxx b/sw/inc/editsh.hxx index 29271604343d..53b91f44db98 100644 --- a/sw/inc/editsh.hxx +++ b/sw/inc/editsh.hxx @@ -816,7 +816,11 @@ public: /// Call AutoCorrect void AutoCorrect( SvxAutoCorrect& rACorr, bool bInsertMode, sal_Unicode cChar ); - bool GetPrevAutoCorrWord(SvxAutoCorrect& rACorr, OUString& rWord); + OUString GetPrevAutoCorrWord(SvxAutoCorrect& rACorr); + + // We consider no more than 9 characters before the cursor, and they must not start in the + // middle of a word (leading spaces are OK) + std::vector<OUString> GetChunkForAutoText(); /// Set our styles according to the respective rules. void AutoFormat( const SvxSwAutoFormatFlags* pAFlags ); |