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 <erack@redhat.com>
Tested-by: Jenkins
diff --git a/cui/source/options/optgdlg.cxx b/cui/source/options/optgdlg.cxx
index 7f5ad32..92acc1b 100644
--- a/cui/source/options/optgdlg.cxx
+++ b/cui/source/options/optgdlg.cxx
@@ -1789,7 +1789,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