[Libreoffice-commits] core.git: Branch 'distro/collabora/co-2021' - sc/source

Dennis Francis (via logerrit) logerrit at kemper.freedesktop.org
Wed Jun 9 07:34:12 UTC 2021


 sc/source/ui/app/inputhdl.cxx |   25 ++++++++++++-------------
 1 file changed, 12 insertions(+), 13 deletions(-)

New commits:
commit 738a3d26b54494113afcb53e106e9629d88311d5
Author:     Dennis Francis <dennis.francis at collabora.com>
AuthorDate: Wed May 19 20:17:01 2021 +0530
Commit:     Dennis Francis <dennis.francis at collabora.com>
CommitDate: Wed Jun 9 09:33:35 2021 +0200

    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 at gmail.com>
    Reviewed-by: Luboš Luňák <l.lunak at collabora.com>
    Reviewed-by: Dennis Francis <dennis.francis at collabora.com>
    (cherry picked from commit ccbbd6bac6aaf5691a66a56b82d2592153336191)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116803

diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index dfcc5347bd22..c04e0db4aa86 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -1977,6 +1977,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;
 
@@ -2011,17 +2021,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 )
@@ -2029,7 +2028,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();
@@ -3670,7 +3669,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 );


More information about the Libreoffice-commits mailing list