Revision: 30074
          http://sourceforge.net/p/bibdesk/svn/30074
Author:   hofman
Date:     2026-02-27 17:26:22 +0000 (Fri, 27 Feb 2026)
Log Message:
-----------
return unreecoverable error when we can't allow recovery from fragile cite key 
characters

Modified Paths:
--------------
    trunk/bibdesk/BDSKEditor.h
    trunk/bibdesk/BDSKEditor.m
    trunk/bibdesk/de.lproj/Localizable.strings
    trunk/bibdesk/en.lproj/Localizable.strings
    trunk/bibdesk/fr.lproj/Localizable.strings

Modified: trunk/bibdesk/BDSKEditor.h
===================================================================
--- trunk/bibdesk/BDSKEditor.h  2026-02-27 17:03:25 UTC (rev 30073)
+++ trunk/bibdesk/BDSKEditor.h  2026-02-27 17:26:22 UTC (rev 30074)
@@ -118,6 +118,7 @@
         unsigned int controllingQLPreviewPanel:1;
         unsigned int controllingFVPreviewPanel:1;
         unsigned int allowFragileCharacters:1;
+        unsigned int rejectFragileCharacters:1;
     } editorFlags;
 }
 

Modified: trunk/bibdesk/BDSKEditor.m
===================================================================
--- trunk/bibdesk/BDSKEditor.m  2026-02-27 17:03:25 UTC (rev 30073)
+++ trunk/bibdesk/BDSKEditor.m  2026-02-27 17:26:22 UTC (rev 30074)
@@ -498,17 +498,9 @@
 }
 
 - (BOOL)commitEditingAndReturnError:(NSError **)error {
+    editorFlags.rejectFragileCharacters = YES;
     BOOL didCommit = [self commitEditingAndReturnRecoverableError:error];
-    if (didCommit == NO && error && [*error localizedRecoveryOptions]) {
-        // no recovery possible, so just make it an unrecoverable error
-        NSError *err = [NSError mutableLocalErrorWithCode:kBDSKFailedToCommit 
localizedDescription:[*error localizedDescription]];
-        NSString *errString = [*error localizedRecoverySuggestion];
-        NSRange r = [errString rangeOfString:@"."];
-        if (r.location != NSNotFound)
-            errString = [errString substringToIndex:NSMaxRange(r)];
-        [err setValue:errString forKey:NSLocalizedRecoverySuggestionErrorKey];
-        *error = err;
-    }
+    editorFlags.rejectFragileCharacters = NO;
     return didCommit;
 }
 
@@ -2087,13 +2079,15 @@
                 
                 isValid = NO;
                 if (error) {
-                    errorCode = [publication canSetCiteKey:[obj 
stringByReplacingCharactersInSet:invalidSet withString:@""]];
+                    BOOL allowRecovery = editorFlags.rejectFragileCharacters 
== NO && BDSKNoCrossrefError == [publication canSetCiteKey:[obj 
stringByReplacingCharactersInSet:invalidSet withString:@""]];
                     
                     NSError *err = [NSError 
mutableLocalErrorWithCode:kBDSKFailedToCommit 
localizedDescription:NSLocalizedString(@"Invalid Value", @"Message in alert 
dialog when entering an invalid value")];
-                    [err setValue:NSLocalizedString(@"The cite key you entered 
contains characters that could be invalid in TeX. Do you want to keep them or 
remove them?", @"Informative text in alert dialog") 
forKey:NSLocalizedRecoverySuggestionErrorKey];
-                    if (errorCode == BDSKNoCrossrefError) {
+                    if (allowRecovery) {
+                        [err setValue:NSLocalizedString(@"The cite key you 
entered contains characters that could be invalid in TeX. Do you want to keep 
them or remove them?", @"Informative text in alert dialog") 
forKey:NSLocalizedRecoverySuggestionErrorKey];
                         [err setValue:self forKey:NSRecoveryAttempterErrorKey];
                         [err setValue:@[NSLocalizedString(@"Remove", @"Button 
title"), NSLocalizedString(@"Keep", @"Button title")] 
forKey:NSLocalizedRecoveryOptionsErrorKey];
+                    } else {
+                        [err setValue:NSLocalizedString(@"The cite key you 
entered contains characters that could be invalid in TeX.", @"Informative text 
in alert dialog") forKey:NSLocalizedRecoverySuggestionErrorKey];
                     }
                     *error = err;
                 }

Modified: trunk/bibdesk/de.lproj/Localizable.strings
===================================================================
(Binary files differ)

Modified: trunk/bibdesk/en.lproj/Localizable.strings
===================================================================
(Binary files differ)

Modified: trunk/bibdesk/fr.lproj/Localizable.strings
===================================================================
(Binary files differ)

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