svx/source/tbxctrls/tbunosearchcontrollers.cxx |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

New commits:
commit 89afe2978500233dc7b58d39cc519ecb9c224e98
Author:     Andreas Heinisch <andreas.heini...@yahoo.de>
AuthorDate: Wed Apr 26 19:40:34 2023 +0200
Commit:     Andreas Heinisch <andreas.heini...@yahoo.de>
CommitDate: Thu Apr 27 11:12:52 2023 +0200

    tdf#154818 - Find bar: remember and reuse last search string
    
    If there exists no last search string in the view options and there
    exists a search history, preselect the last search item.
    
    Change-Id: Ic6056e02eaf6c0ee7e266e47ba961dff11e9f9da
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151072
    Tested-by: Jenkins
    Reviewed-by: Andreas Heinisch <andreas.heini...@yahoo.de>

diff --git a/svx/source/tbxctrls/tbunosearchcontrollers.cxx 
b/svx/source/tbxctrls/tbunosearchcontrollers.cxx
index d43222fe4e32..1ae8a0b5c738 100644
--- a/svx/source/tbxctrls/tbunosearchcontrollers.cxx
+++ b/svx/source/tbxctrls/tbunosearchcontrollers.cxx
@@ -268,9 +268,12 @@ void FindTextFieldControl::SetTextToSelected_Impl()
         {
             css::uno::Any aUserItem = aDlgOpt.GetUserItem("UserItem");
             aUserItem >>= aString;
-            // prepopulate with last search word (fdo#84256)
-            m_xWidget->set_entry_text(aString);
         }
+        else if (get_count() > 0)
+            aString = m_xWidget->get_text(0);
+
+        // prepopulate with last search word (fdo#84256)
+        m_xWidget->set_entry_text(aString);
     }
 }
 

Reply via email to