diff options
author | Caolán McNamara <caolanm@redhat.com> | 2019-11-18 13:44:46 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2019-11-18 21:58:17 +0100 |
commit | 57c901adc6dd1441057fb93970e7c25f1d36a9ca (patch) | |
tree | 56d5d847a4831e88b85a550f5f318a2d2580f5fe /svx/source/dialog | |
parent | 5739daad969efce4e4f19ed30e32c842bddf98cf (diff) |
rhbz#1773525 wrong elements removed from saved entries when limit hit
Change-Id: Iaf8a012ffe927cbf38789e97b469d899e7cbf87b
Reviewed-on: https://gerrit.libreoffice.org/83094
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'svx/source/dialog')
-rw-r--r-- | svx/source/dialog/srchdlg.cxx | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/svx/source/dialog/srchdlg.cxx b/svx/source/dialog/srchdlg.cxx index a2d2747e0221..85b5560b1558 100644 --- a/svx/source/dialog/srchdlg.cxx +++ b/svx/source/dialog/srchdlg.cxx @@ -1581,16 +1581,16 @@ void SvxSearchDialog::Remember_Impl( const OUString &rStr, bool _bSearch ) if (std::find(pArr->begin(), pArr->end(), rStr) != pArr->end()) return; + pArr->insert(pArr->begin(), rStr); + pListBox->insert_text(0, rStr); + // delete oldest entry at maximum occupancy (ListBox and Array) - if(nRememberSize < pArr->size()) + size_t nArrSize = pArr->size(); + if (nArrSize > nRememberSize) { - pListBox->remove(static_cast<sal_uInt16>(nRememberSize - 1)); - (*pArr)[nRememberSize - 1] = rStr; - pArr->erase(pArr->begin() + nRememberSize - 1); + pListBox->remove(nArrSize - 1); + pArr->erase(pArr->begin() + nArrSize - 1); } - - pArr->insert(pArr->begin(), rStr); - pListBox->insert_text(0, rStr); } void SvxSearchDialog::TemplatesChanged_Impl( SfxStyleSheetBasePool& rPool ) |