summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorDennis Francis <dennis.francis@collabora.com>2021-05-19 20:17:01 +0530
committerDennis Francis <dennis.francis@collabora.com>2021-06-09 09:30:45 +0200
commit299227ad81d4a44556fda8cca7b8b79219ba7e6c (patch)
tree9c4a1f10adf094c69069278ca44e2ad3fe54ffcd /sc
parent10f501dec737f3c3da21d9df2b204d0385290477 (diff)
autocomplete: allow cycling through possible matches
Conflicts: sc/source/ui/app/inputhdl.cxx 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> (cherry picked from commit ccbbd6bac6aaf5691a66a56b82d2592153336191) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116539 Tested-by: Jenkins
Diffstat (limited to 'sc')
-rw-r--r--sc/source/ui/app/inputhdl.cxx25
1 files changed, 12 insertions, 13 deletions
diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index 194049e999e8..a8bf4a39e8f9 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -1975,6 +1975,16 @@ 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 (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;
+ return;
+ }
+
if (!bShowCompletion)
return;
@@ -2009,17 +2019,6 @@ void ScInputHandler::UseColData() // When typing
}
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;
}
void ScInputHandler::NextAutoEntry( bool bBack )
@@ -2027,7 +2026,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();
@@ -3659,7 +3658,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 );