Revision: 29408 http://sourceforge.net/p/bibdesk/svn/29408 Author: hofman Date: 2025-07-31 14:06:25 +0000 (Thu, 31 Jul 2025) Log Message: ----------- always set textfield value when swapping formatter, restore editing string when not changing complex editing
Modified Paths: -------------- trunk/bibdesk/BDSKEditor.m Modified: trunk/bibdesk/BDSKEditor.m =================================================================== --- trunk/bibdesk/BDSKEditor.m 2025-07-31 09:33:45 UTC (rev 29407) +++ trunk/bibdesk/BDSKEditor.m 2025-07-31 14:06:25 UTC (rev 29408) @@ -3322,27 +3322,17 @@ NSString *value = [publication valueOfField:field] ?: @""; [textField setRepresentedObject:[self representedObjectForValue:value forField:field]]; NSFormatter *formatter = [field isEqualToString:BDSKCrossrefString] ? crossrefFormatter : [field isCitationField] ? citationFormatter : tableCellFormatter; - NSFormatter *oldFormatter = [textField formatter]; - if (formatter != oldFormatter) { + if (formatter != [textField formatter]) { id editor = [textField currentEditor]; - BOOL wasComplexEditing = editor && oldFormatter == tableCellFormatter && [tableCellFormatter editAsComplexString]; + NSString *editingString = editorFlags.isEditing ? [[editor string] copy] : nil; + BOOL wasComplexEditing = editor && [textField formatter] == tableCellFormatter && [tableCellFormatter editAsComplexString]; [textField setFormatter:formatter]; + [textField setObjectValue:value]; if (editor) { - if (wasComplexEditing) { + if (wasComplexEditing) [tableCellFormatter setEditAsComplexString:NO]; - [textField setObjectValue:value]; - } else { - if (formatter == tableCellFormatter) { - if ([value isComplex]) - [textField setObjectValue:value]; - else - [tableCellFormatter editingStringForObjectValue:value]; - } - if (formatter == citationFormatter || oldFormatter == citationFormatter) - [editor setString:[editor string]]; - } - } else if ([[textField objectValue] isEqualAsComplexString:value] == NO) { - [textField setObjectValue:value]; + else if (editingString && (formatter != tableCellFormatter || [tableCellFormatter editAsComplexString] == NO) && [[editor string] isEqualToString:editingString] == NO) + [editor setString:editingString]; } } }]; 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