Author: mlytwyn
Date: Fri Feb 17 21:11:39 2017
New Revision: 40347

URL: http://svn.gna.org/viewcvs/gnustep?rev=40347&view=rev
Log:
Only invoke 'setObjectValue' from NSTableView if new value id diff from 
current/old value

Modified:
    libs/gui/branches/gnustep_testplant_branch/Source/NSTableView.m

Modified: libs/gui/branches/gnustep_testplant_branch/Source/NSTableView.m
URL: 
http://svn.gna.org/viewcvs/gnustep/libs/gui/branches/gnustep_testplant_branch/Source/NSTableView.m?rev=40347&r1=40346&r2=40347&view=diff
==============================================================================
--- libs/gui/branches/gnustep_testplant_branch/Source/NSTableView.m     
(original)
+++ libs/gui/branches/gnustep_testplant_branch/Source/NSTableView.m     Fri Feb 
17 21:11:39 2017
@@ -3322,21 +3322,24 @@
         {
           NSString *error;
          
-          if ([formatter getObjectValue: &newObjectValue 
-                         forString: string 
-                         errorDescription: &error] == YES)
+          if ([formatter getObjectValue: &newObjectValue
+                              forString: string
+                       errorDescription: &error] == YES)
             {
-              [_editedCell setObjectValue: newObjectValue];
-              
-              if (_dataSource_editable)
+              if ([[_editedCell objectValue] isEqual: newObjectValue] == NO)
                 {
-                  NSTableColumn *tb;
-              
-                  tb = [_tableColumns objectAtIndex: _editedColumn];
+                  [_editedCell setObjectValue: newObjectValue];
                   
-                  [self _setObjectValue: newObjectValue
-                        forTableColumn: tb
-                        row: _editedRow];
+                  if (_dataSource_editable)
+                    {
+                      NSTableColumn *tb;
+                      
+                      tb = [_tableColumns objectAtIndex: _editedColumn];
+                      
+                      [self _setObjectValue: newObjectValue
+                             forTableColumn: tb
+                                        row: _editedRow];
+                    }
                 }
               return;
             }
@@ -3364,22 +3367,25 @@
           // Generate an attributed string per Cocoa behavior...
           id object = string;
           
-          if ([_editedCell allowsEditingTextAttributes])
-          {
-            NSTextView *textView = (NSTextView*)_textObject;
-            object = AUTORELEASE([[NSAttributedString alloc] 
initWithAttributedString:[textView textStorage]]);
-          }
-
-          [_editedCell setObjectValue: object];
-          
-          if (_dataSource_editable)
+          if ([[_editedCell objectValue] isEqual: object] == NO)
             {
-              // Need to pass string or attributedString based on cell 
settings...
-              NSTableColumn *tb     = [_tableColumns objectAtIndex: 
_editedColumn];
+              if ([_editedCell allowsEditingTextAttributes])
+                {
+                  NSTextView *textView = (NSTextView*)_textObject;
+                  object = AUTORELEASE([[NSAttributedString alloc] 
initWithAttributedString:[textView textStorage]]);
+                }
               
-              [self _setObjectValue: object // newObjectValue
-                     forTableColumn: tb
-                                row: _editedRow];
+              [_editedCell setObjectValue: object];
+              
+              if (_dataSource_editable)
+                {
+                  // Need to pass string or attributedString based on cell 
settings...
+                  NSTableColumn *tb     = [_tableColumns objectAtIndex: 
_editedColumn];
+                  
+                  [self _setObjectValue: object // newObjectValue
+                         forTableColumn: tb
+                                    row: _editedRow];
+                }
             }
         }
 


_______________________________________________
Gnustep-cvs mailing list
Gnustep-cvs@gna.org
https://mail.gna.org/listinfo/gnustep-cvs

Reply via email to