sc/source/ui/app/inputhdl.cxx |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit b2fb1631ab5b3c1d9d09aefa0d3a81307e7ffa35
Author:     Justin Luth <justin_l...@sil.org>
AuthorDate: Mon Dec 13 11:21:21 2021 +0200
Commit:     Eike Rathke <er...@redhat.com>
CommitDate: Mon Dec 13 22:18:42 2021 +0100

    related tdf#92010 sc autoformula: ensure proper sorting order
    
    When typing "=a", autoformula was suggesting
    ACCRINT,ACCRINTM,ACOS instead of starting with ABS.
    [This has been true since these 3 suggestions started in LO 5.2.]
    
    Prior to this patch, the very first item in the sorted list
    (ABS) was placed at the end of the suggestion vector.
    That is because the loop immediately increments.
    Since the given initialization value is end(),
    it set begin() as the starting loop value and then
    immediately incremented to item 2.
    Item 1 was finally evaluated last, putting ABS after ZTEST.
    
    The backwards loop handled this properly,
    so do the same thing for the forward loop.
    
    Change-Id: I539c749ea43140a1480d74471787bc886dda671e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126723
    Tested-by: Jenkins
    Reviewed-by: Justin Luth <jl...@mail.com>
    Reviewed-by: Eike Rathke <er...@redhat.com>

diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index f05f52fa90bd..1abff527b363 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -255,7 +255,7 @@ ScTypedCaseStrSet::const_iterator findTextAll(
         ScTypedCaseStrSet::const_iterator it, itEnd;
         it = itPos;
         if ( it == rDataSet.end() )
-            it = rDataSet.begin();
+            it = --rDataSet.end();
         itEnd = it;
         bool bFirstTime = true;
 

Reply via email to