Revision: 29409 http://sourceforge.net/p/bibdesk/svn/29409 Author: hofman Date: 2025-07-31 14:28:21 +0000 (Thu, 31 Jul 2025) Log Message: ----------- restore selection after changing formatter
Modified Paths: -------------- trunk/bibdesk/BDSKEditor.m Modified: trunk/bibdesk/BDSKEditor.m =================================================================== --- trunk/bibdesk/BDSKEditor.m 2025-07-31 14:06:25 UTC (rev 29408) +++ trunk/bibdesk/BDSKEditor.m 2025-07-31 14:28:21 UTC (rev 29409) @@ -3323,8 +3323,9 @@ [textField setRepresentedObject:[self representedObjectForValue:value forField:field]]; NSFormatter *formatter = [field isEqualToString:BDSKCrossrefString] ? crossrefFormatter : [field isCitationField] ? citationFormatter : tableCellFormatter; if (formatter != [textField formatter]) { - id editor = [textField currentEditor]; + NSTextView *editor = (NSTextView *)[textField currentEditor]; NSString *editingString = editorFlags.isEditing ? [[editor string] copy] : nil; + NSArray *selection = [editor selectedRanges]; BOOL wasComplexEditing = editor && [textField formatter] == tableCellFormatter && [tableCellFormatter editAsComplexString]; [textField setFormatter:formatter]; [textField setObjectValue:value]; @@ -3333,6 +3334,7 @@ [tableCellFormatter setEditAsComplexString:NO]; else if (editingString && (formatter != tableCellFormatter || [tableCellFormatter editAsComplexString] == NO) && [[editor string] isEqualToString:editingString] == NO) [editor setString:editingString]; + [editor setSafeSelectedRanges:selection]; } } }]; 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