From aa2ebf7d77527a12246797f637a06af0e9dea5f9 Mon Sep 17 00:00:00 2001 From: Eike Rathke Date: Sun, 12 Sep 2021 17:47:35 +0200 Subject: Resolves: tdf#144457 Use weld::set_text() instead of replace_selection() ... to replace entire field with modified text, instead of inserting the text at the cursor position without selection, thus effectively duplicating it (modulo modification). Fallout from commit 08101a1ab3b5d7c41488e93a2af518462286844f CommitDate: Tue Jul 30 14:04:17 2019 +0200 weld OfaLanguagesTabPage that did if (bModified) - { - // Do not use SetText(...,GetSelection()) because internally the - // reference's pointer of the selection is obtained resulting in the - // entire text being selected at the end. - Selection aSelection( rEd.GetSelection()); - rEd.SetText( aBuf.makeStringAndClear(), aSelection); - } + rEd.replace_selection(aBuf.makeStringAndClear()); replacing the workaround needed for the old toolkit with something similar from the new toolkit but behaving differently.. Change-Id: I9ff325eecd747bbecb36eb2a1150ae4472e475e8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122000 Reviewed-by: Eike Rathke Tested-by: Jenkins (cherry picked from commit db90a6cedbc261ad711ff13c4f69db65946486da) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121978 Reviewed-by: Adolfo Jayme Barrientos --- cui/source/options/optgdlg.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cui/source/options/optgdlg.cxx b/cui/source/options/optgdlg.cxx index fd79d34926f1..4d376043ced7 100644 --- a/cui/source/options/optgdlg.cxx +++ b/cui/source/options/optgdlg.cxx @@ -1783,7 +1783,7 @@ IMPL_LINK( OfaLanguagesTabPage, DatePatternsHdl, weld::Entry&, rEd, void ) } } if (bModified) - rEd.replace_selection(aBuf.makeStringAndClear()); + rEd.set_text(aBuf.makeStringAndClear()); // This even keeps the cursor position so all good. if (bValid) rEd.set_message_type(weld::EntryMessageType::Normal); else -- cgit