Revision: 30043
          http://sourceforge.net/p/bibdesk/svn/30043
Author:   hofman
Date:     2026-02-22 17:44:09 +0000 (Sun, 22 Feb 2026)
Log Message:
-----------
use minNumberOfFields to check for extra fields

Modified Paths:
--------------
    trunk/bibdesk/BDSKEditor.m

Modified: trunk/bibdesk/BDSKEditor.m
===================================================================
--- trunk/bibdesk/BDSKEditor.m  2026-02-22 17:31:03 UTC (rev 30042)
+++ trunk/bibdesk/BDSKEditor.m  2026-02-22 17:44:09 UTC (rev 30043)
@@ -2420,7 +2420,8 @@
         else if([changeKey isPersonField])
             [authorTableView reloadData];
         
-        if (([NSString isEmptyAsComplexString:newValue] != [NSString 
isEmptyAsComplexString:oldValue]) && [addedFields containsObject:changeKey] == 
NO && [[[BDSKTypeManager sharedManager] regularFieldsForType:[publication 
pubType]] containsObject:changeKey] == NO) {
+        NSInteger row = [fields indexOfObject:changeKey];
+        if (row >= minNumberOfFields && ([NSString 
isEmptyAsComplexString:newValue] != [NSString 
isEmptyAsComplexString:oldValue])) {
                        // a custom field was added or removed
             NSInteger editedRow = [tableView editedTextRow];
             if (editedRow != -1 && [[fields objectAtIndex:editedRow] 
isEqualToString:changeKey]) {
@@ -2429,18 +2430,15 @@
                 [[textField currentEditor] setString:[textField formatter] ? 
[[textField formatter] editingStringForObjectValue:tmpValue] : tmpValue];
             }
             [self reloadTableWithFields:[self currentFields]];
-               } else {
+        } else if (row != NSNotFound) {
             // a field value changed
-            NSUInteger row = [fields indexOfObject:changeKey];
-            if (row != NSNotFound) {
-                // don't use newValue, because this can be the parent's value
-                NSString *tmpValue = [publication valueOfField:changeKey] ?: 
@"";
-                BDSKEditorTextField *textField = [self textFieldAtRow:row];
-                [textField setObjectValue:tmpValue];
-                [textField setRepresentedObject:[self 
representedObjectForValue:tmpValue forField:changeKey]];
-                if ([textField currentEditor] && [tableCellFormatter 
editAsComplexString])
-                    [tableCellFormatter didStartEditor:[textField 
currentEditor]];
-            }
+            // don't use newValue, because this can be the parent's value
+            NSString *tmpValue = [publication valueOfField:changeKey] ?: @"";
+            BDSKEditorTextField *textField = [self textFieldAtRow:row];
+            [textField setObjectValue:tmpValue];
+            [textField setRepresentedObject:[self 
representedObjectForValue:tmpValue forField:changeKey]];
+            if ([textField currentEditor] && [tableCellFormatter 
editAsComplexString])
+                [tableCellFormatter didStartEditor:[textField currentEditor]];
         }
     }
     

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit

Reply via email to