diff options
author | Dennis Francis <dennis.francis@collabora.com> | 2021-05-19 20:17:01 +0530 |
---|---|---|
committer | Dennis Francis <dennis.francis@collabora.com> | 2021-06-01 10:16:19 +0200 |
commit | ccbbd6bac6aaf5691a66a56b82d2592153336191 (patch) | |
tree | 5475dce7a44ce241120580f73aa7c5e73e748542 /sc | |
parent | 2691f74e454870c549ec395f9d19cb88538d1c50 (diff) |
autocomplete: allow cycling through possible matches
Change-Id: I4a4b11312f36885d1c6fbe43c4850d55293b2557
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115859
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
Reviewed-by: Dennis Francis <dennis.francis@collabora.com>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/ui/app/inputhdl.cxx | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx index 91a5679ddcf2..d274f713334e 100644 --- a/sc/source/ui/app/inputhdl.cxx +++ b/sc/source/ui/app/inputhdl.cxx @@ -1952,6 +1952,7 @@ void ScInputHandler::UseColData() // When typing miAutoPosColumn = pColumnData->end(); miAutoPosColumn = findTextAll(*pColumnData, miAutoPosColumn, aText, aResultVec, false, 2); bool bShowCompletion = (aResultVec.size() == 1); + bUseTab = (aResultVec.size() == 2); if (bShowCompletion) { assert(miAutoPosColumn != pColumnData->end()); @@ -1984,18 +1985,14 @@ void ScInputHandler::UseColData() // When typing pTopView->SetSelection( aSelection ); } - aAutoSearch = aText; // To keep searching - nAutoPos is set - - if (aText.getLength() == aNew.getLength()) - { - // If the inserted text is found, consume TAB only if there's more coming - OUString aDummy; - ScTypedCaseStrSet::const_iterator itNextPos = - findText(*pColumnData, miAutoPosColumn, aText, aDummy, false); - bUseTab = itNextPos != pColumnData->end(); - } - else - bUseTab = true; + aAutoSearch = aText; + } + else if (bUseTab) + { + // Allow cycling through possible matches using shortcut. + // Make miAutoPosColumn invalid so that Ctrl+TAB provides the first matching one. + miAutoPosColumn = pColumnData->end(); + aAutoSearch = aText; } } } @@ -2008,7 +2005,7 @@ void ScInputHandler::NextAutoEntry( bool bBack ) EditView* pActiveView = pTopView ? pTopView : pTableView; if ( pActiveView && pColumnData ) { - if (miAutoPosColumn != pColumnData->end() && !aAutoSearch.isEmpty()) + if (!aAutoSearch.isEmpty()) { // Is the selection still valid (could be changed via the mouse)? ESelection aSel = pActiveView->GetSelection(); @@ -3636,7 +3633,7 @@ bool ScInputHandler::KeyInput( const KeyEvent& rKEvt, bool bStartEdit /* = false NextFormulaEntry( bShift ); bUsed = true; } - else if (pColumnData && bUseTab && miAutoPosColumn != pColumnData->end()) + else if (pColumnData && bUseTab) { // Iterate through AutoInput entries NextAutoEntry( bShift ); |