tdf#151688 srchdlg: on open, repopulate Replace as well as Search

When the dialog is opened, the last searched for string
(from the session, not from stored config) was already restored.
However, no attempt was made to restore the last replace string.

Although it might feel a little dangerous to provide a restore value,
it isn't really dangerous, because the user has to hit the
replace button in order for it to do anything.

The bug report is worried about replacing with 'nothing' by accident,
so I guess the 'danger' goes both ways.

Personally, I would like having both last values restored
in case I accidentally closed the dialog
(or closed it to get it out of the way while I manually made changes
and then restarted it to continue my replace task).

Only Writer replaces the 'search' content with a user's selection.
In this case it seems very wise to clear the replacement string.

Change-Id: Id9f40c01724978a2e51f685a60b9e3e75c21135a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/207901
Reviewed-by: Justin Luth <jluth@mail.com>
Tested-by: Jenkins
This commit is contained in:
Justin Luth
2026-07-10 23:55:38 +02:00
parent 5b777fe9ce
commit 5525f5e89b
2 changed files with 5 additions and 0 deletions
+4
View File
@@ -967,7 +967,11 @@ void SvxSearchDialog::Init_Impl( bool bSearchPattern )
if (!comphelper::LibreOfficeKit::isActive())
{
if (!(m_pSearchItem->GetSearchString().isEmpty()) && bSetSearch)
{
m_xSearchLB->set_entry_text(m_pSearchItem->GetSearchString());
if (bSetReplace)
m_xReplaceLB->set_entry_text(m_pSearchItem->GetReplaceString());
}
else if (!m_aSearchStrings.empty())
{
bool bAttributes = ((m_pSearchList && m_pSearchList->Count())
+1
View File
@@ -886,6 +886,7 @@ void SwView::StateSearch(SfxItemSet &rSet)
{
s_pSrchItem->SetSearchString( aText );
s_pSrchItem->SetSelection( false );
s_pSrchItem->SetReplaceString("");
}
else
s_pSrchItem->SetSelection( true );