[Libreoffice-commits] core.git: formula/source

Eike Rathke erack at redhat.com
Thu Aug 20 14:06:04 PDT 2015


 formula/source/ui/dlg/funcutl.cxx |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

New commits:
commit e1ebe5723833eebdb8e68f56d2075cb174d57398
Author: Eike Rathke <erack at redhat.com>
Date:   Thu Aug 20 23:01:17 2015 +0200

    let the edit selection not jump back to 0,0 for every keystroke
    
    ... which instead of an input of 123 resulted in 321.
    
    This Edit::SetText() has a side-effect that it sets a new Selection(0,0)
    effectively invalidating the previous selection. We reach
    RefEdit::SetRefString() also through notification of edit events that
    already handled the key input in Edit::ImplInsertText() and adapted the
    selection, the dialog then attempts to update all sort of argument
    fields, including the one that was just edited. Setting the identical
    text again confuses the selection and positions the cursor at the
    beginning of the string instead of the end when typing. Additionally all
    kind of invalidations and recalculations happen that were just correct..
    
    This somehow worked before (what change?), maybe just by accident,
    Edit::SetText() always set that new selection. However, calculating all
    the rat tail for an identical text is unnecessary and hopefully nothing
    relies on it. If something did, we'd need to remember and set the
    original selection here after setting the text, or adapt the believer..
    
    Change-Id: Ibe086f3620db921dc852280e73789218d81f5c39

diff --git a/formula/source/ui/dlg/funcutl.cxx b/formula/source/ui/dlg/funcutl.cxx
index c620f38..dc2c160 100644
--- a/formula/source/ui/dlg/funcutl.cxx
+++ b/formula/source/ui/dlg/funcutl.cxx
@@ -507,7 +507,10 @@ void RefEdit::dispose()
 
 void RefEdit::SetRefString( const OUString& rStr )
 {
-    Edit::SetText( rStr );
+    // Prevent unwanted side effects by setting only a differing string.
+    // See commit message for reasons.
+    if (Edit::GetText() != rStr)
+        Edit::SetText( rStr );
 }
 
 void RefEdit::SetRefValid(bool bValid)


More information about the Libreoffice-commits mailing list