svtools/source/control/ctrlbox.cxx |   12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

New commits:
commit 54aaa6a1e475921573f07d3e5a3a1f22018574bb
Author:     Caolán McNamara <[email protected]>
AuthorDate: Wed Oct 29 17:45:28 2025 +0000
Commit:     Adolfo Jayme Barrientos <[email protected]>
CommitDate: Thu Oct 30 04:19:45 2025 +0100

    Resolves: tdf#165265 don't autoselect a font style
    
    If nothing was originally selected, then don't pick anything and leave
    the combobox empty so the search for style feature doesn't add any
    not-explicitly selected font styles by default.
    
    Continue to restore a previously selected style, favouring the last
    explicitly selected-by-user style.
    
    Change-Id: Iad04d80305029cc3bbe3e8500ced87085645f9f4
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/193160
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <[email protected]>
    (cherry picked from commit e419d3927b62cbc90bbfd0f893adb268af38afdf)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/193171
    Reviewed-by: Adolfo Jayme Barrientos <[email protected]>

diff --git a/svtools/source/control/ctrlbox.cxx 
b/svtools/source/control/ctrlbox.cxx
index 73683698db52..1737375dd16a 100644
--- a/svtools/source/control/ctrlbox.cxx
+++ b/svtools/source/control/ctrlbox.cxx
@@ -1059,14 +1059,18 @@ void FontStyleBox::Fill( std::u16string_view rName, 
const FontList* pList )
     {
         int nFound = m_xComboBox->find_text(aOldText);
         if (nFound != -1)
-        {
             m_xComboBox->set_active(nFound);
-            return;
+        else
+        {
+            // otherwise, just pick something
+            m_xComboBox->set_active(0);
         }
     }
 
-    // otherwise, just pick something
-    m_xComboBox->set_active(0);
+    // tdf#165265 if nothing was originally selected, then
+    // don't pick anything and leave the combobox empty
+    // so the search for style feature doesn't add any
+    // not-explicitly selected font styles by default
 }
 
 FontSizeBox::FontSizeBox(std::unique_ptr<weld::ComboBox> p)

Reply via email to