Revision: 27448
          http://sourceforge.net/p/bibdesk/svn/27448
Author:   hofman
Date:     2022-05-21 09:32:23 +0000 (Sat, 21 May 2022)
Log Message:
-----------
update changed edited field separately for each case

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

Modified: trunk/bibdesk/BDSKEditor.m
===================================================================
--- trunk/bibdesk/BDSKEditor.m  2022-05-21 06:30:17 UTC (rev 27447)
+++ trunk/bibdesk/BDSKEditor.m  2022-05-21 09:32:23 UTC (rev 27448)
@@ -2489,35 +2489,34 @@
         else if([changeKey isPersonField])
             [authorTableView reloadData];
         
-        NSInteger editedRow = [tableView editedTextRow];
-        BDSKEditorTextField *textField = nil;
-        if (editedRow != -1 && [[fields objectAtIndex:editedRow] 
isEqualToString:changeKey]) {
-            NSString *tmpValue = [publication valueOfField:changeKey] ?: @"";
-            textField = [self textFieldAtRow:editedRow];
-            if ([textField formatter])
-                tmpValue = [[textField formatter] 
editingStringForObjectValue:tmpValue];
-            [[textField currentEditor] setString:tmpValue];
-        }
-        
         if (([NSString isEmptyAsComplexString:newValue] != [NSString 
isEmptyAsComplexString:oldValue]) && [addedFields containsObject:changeKey] == 
NO && [[[BDSKTypeManager sharedManager] standardFieldsForType:[publication 
pubType]] containsObject:changeKey] == NO) {
                        // a custom field was added or removed
+            NSInteger editedRow = [tableView editedTextRow];
+            NSString *tmpValue = nil;
+            BDSKEditorTextField *textField = nil;
+            if (editedRow != -1 && [[fields objectAtIndex:editedRow] 
isEqualToString:changeKey]) {
+                tmpValue = [publication valueOfField:changeKey] ?: @"";
+                textField = [self textFieldAtRow:editedRow];
+                [[textField currentEditor] setString:[textField formatter] ? 
[[textField formatter] editingStringForObjectValue:tmpValue] : tmpValue];
+            }
             [self resetFields];
                } else {
             // a field value changed
             // don't use newValue, because this can be the parent's value
-            NSString *value = [publication valueOfField:changeKey];
-            if (textField == nil) {
-                NSUInteger row = [fields indexOfObject:changeKey];
-                if (row != NSNotFound)
-                    textField = [self textFieldAtRow:row];
+            NSString *tmpValue = [publication valueOfField:changeKey] ?: @"";
+            NSUInteger row = [fields indexOfObject:changeKey];
+            if (row != NSNotFound) {
+                BDSKEditorTextField *textField = [self textFieldAtRow:row];
+                if ([textField currentEditor])
+                    [[textField currentEditor] setString:[textField formatter] 
? [[textField formatter] editingStringForObjectValue:tmpValue] : tmpValue];
+                [textField setObjectValue:tmpValue];
+                id object = nil;
+                if ([tmpValue isInherited])
+                    object = [[[BDSKField alloc] initWithName:changeKey 
bibItem:nil] autorelease];
+                else if ([changeKey isURLField])
+                    object = [publication URLForField:changeKey];
+                [textField setRepresentedObject:object];
             }
-            [textField setObjectValue:value ?: @""];
-            id object = nil;
-            if ([value isInherited])
-                object = [[[BDSKField alloc] initWithName:changeKey 
bibItem:nil] autorelease];
-            else if ([changeKey isURLField])
-                object = [publication URLForField:changeKey];
-            [textField setRepresentedObject:object];
         }
     }
        else{
@@ -2526,9 +2525,8 @@
         if (editedRow != -1) {
             NSString *key = [fields objectAtIndex:editedRow];
             NSString *tmpValue = [publication valueOfField:key] ?: @"";
-            if ([changeKey isCitationField] == NO && [tableCellFormatter 
editAsComplexString])
-                tmpValue = [tmpValue stringAsBibTeXString];
-            [[[self textFieldAtRow:editedRow] currentEditor] 
setString:tmpValue];
+            NSTextField *textField = [self textFieldAtRow:editedRow];
+            [[textField currentEditor] setString:[textField formatter] ? 
[[textField formatter] editingStringForObjectValue:tmpValue] : tmpValue];
         }
                [self resetFields];
         [self setupCollectionView];

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



_______________________________________________
Bibdesk-commit mailing list
Bibdesk-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit

Reply via email to