Revision: 29382
http://sourceforge.net/p/bibdesk/svn/29382
Author: hofman
Date: 2025-07-28 09:41:03 +0000 (Mon, 28 Jul 2025)
Log Message:
-----------
chek for unrecovarable error first, otherwise we could recover to allow a real
error
Modified Paths:
--------------
trunk/bibdesk/BDSKEditor.m
Modified: trunk/bibdesk/BDSKEditor.m
===================================================================
--- trunk/bibdesk/BDSKEditor.m 2025-07-28 09:37:16 UTC (rev 29381)
+++ trunk/bibdesk/BDSKEditor.m 2025-07-28 09:41:03 UTC (rev 29382)
@@ -2100,36 +2100,35 @@
if (control == citeKeyField) {
- NSString *message = nil;
- NSCharacterSet *invalidSet = [[BDSKTypeManager sharedManager]
fragileCiteKeyCharacterSet];
- NSRange r = [obj rangeOfCharacterFromSet:invalidSet];
-
- // check for fragile invalid characters, as the formatter doesn't do
this
- if (r.location != NSNotFound && editorFlags.allowFragileCharacters ==
NO) {
-
+ // check whether we won't crossref to the new citekey
+ BDSKCrossrefError errorCode = [publication canSetCiteKey:[control
stringValue]];
+ if (errorCode != BDSKNoCrossrefError) {
isValid = NO;
if (error) {
+ NSString *message = nil;
+ if (errorCode == BDSKSelfCrossrefError)
+ message = NSLocalizedString(@"An item cannot cross
reference to itself.", @"Informative text in alert dialog");
+ else // shouldn't happen
+ message = NSLocalizedString(@"Cannot set this cite key as
this would lead to a crossreff chain.", @"Informative text in alert dialog");
+
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];
- [err setValue:self forKey:NSRecoveryAttempterErrorKey];
- [err setValue:@[NSLocalizedString(@"Remove", @"Button title"),
NSLocalizedString(@"Keep", @"Button title")]
forKey:NSLocalizedRecoveryOptionsErrorKey];
+ [err setValue:message
forKey:NSLocalizedRecoverySuggestionErrorKey];
}
-
} else {
+ NSCharacterSet *invalidSet = [[BDSKTypeManager sharedManager]
fragileCiteKeyCharacterSet];
+ NSRange r = [obj rangeOfCharacterFromSet:invalidSet];
- // check whether we won't crossref to the new citekey
- BDSKCrossrefError errorCode = [publication canSetCiteKey:[control
stringValue]];
- if (errorCode != BDSKNoCrossrefError) {
+ // check for fragile invalid characters, as the formatter doesn't
do this
+ if (r.location != NSNotFound && editorFlags.allowFragileCharacters
== NO) {
+
isValid = NO;
if (error) {
- if (errorCode == BDSKSelfCrossrefError)
- message = NSLocalizedString(@"An item cannot cross
reference to itself.", @"Informative text in alert dialog");
- else // shouldn't happen
- message = NSLocalizedString(@"Cannot set this cite key
as this would lead to a crossreff chain.", @"Informative text in alert dialog");
-
err = [NSError
mutableLocalErrorWithCode:kBDSKFailedToCommit
localizedDescription:NSLocalizedString(@"Invalid Value", @"Message in alert
dialog when entering an invalid value")];
- [err setValue:message
forKey:NSLocalizedRecoverySuggestionErrorKey];
+ [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];
}
+
}
}
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