sw/source/ui/fldui/fldref.cxx |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

New commits:
commit 874e93d02ae4875db226a855ac06c33d3b093cd5
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Mon Aug 5 21:23:40 2024 +0100
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Tue Aug 6 09:15:05 2024 +0200

    Resolves: tdf#141398 auto-select first entry of filtered results
    
    apparent regression from:
    
    commit c403c86c6da4db0a6f2864ad4e13def9a3898cd4
    Author:     Caolán McNamara <caol...@redhat.com>
    AuthorDate: Sun Mar 17 19:22:08 2019 +0000
    
        weld SwFieldRefPage
    
        Change-Id: I5ae3965aa681ea1f5a005fbc8dad4d0ce36af1b3
        Reviewed-on: https://gerrit.libreoffice.org/69373
    
    Change-Id: Icb868403d31e1a6b57ae957f4eb98deafcc7f940
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171514
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>

diff --git a/sw/source/ui/fldui/fldref.cxx b/sw/source/ui/fldui/fldref.cxx
index 44013b89edef..9001aa634bc8 100644
--- a/sw/source/ui/fldui/fldref.cxx
+++ b/sw/source/ui/fldui/fldref.cxx
@@ -790,12 +790,14 @@ void SwFieldRefPage::UpdateSubType(const OUString& 
filterString)
     m_xSelectionLB->set_visible( !bShowSelectionToolTipLB );
     if ( bShowSelectionToolTipLB )
     {
-        bool bEnable = m_xSelectionToolTipLB->n_children() != 0;
-        m_xSelection->set_sensitive( bEnable );
+        bool bHasChildren = m_xSelectionToolTipLB->n_children() != 0;
+        m_xSelection->set_sensitive(bHasChildren);
 
         int nEntry = m_xSelectionToolTipLB->get_selected_index();
         if (nEntry != -1)
             m_xSelectionToolTipLB->scroll_to_row(nEntry);
+        else if (bHasChildren)
+            m_xSelectionToolTipLB->select(0);
 
         if (IsFieldEdit() && nEntry == -1)
         {

Reply via email to