cui/source/options/optgdlg.cxx |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit db90a6cedbc261ad711ff13c4f69db65946486da
Author:     Eike Rathke <er...@redhat.com>
AuthorDate: Sun Sep 12 17:47:35 2021 +0200
Commit:     Eike Rathke <er...@redhat.com>
CommitDate: Sun Sep 12 18:42:00 2021 +0200

    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 <er...@redhat.com>
    Tested-by: Jenkins

diff --git a/cui/source/options/optgdlg.cxx b/cui/source/options/optgdlg.cxx
index 7f5ad32fce0b..92acc1bc0001 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

Reply via email to