Revision: 29291
          http://sourceforge.net/p/bibdesk/svn/29291
Author:   hofman
Date:     2025-07-18 09:21:33 +0000 (Fri, 18 Jul 2025)
Log Message:
-----------
add and update some comments

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

Modified: trunk/bibdesk/BDSKEditor.m
===================================================================
--- trunk/bibdesk/BDSKEditor.m  2025-07-18 09:07:53 UTC (rev 29290)
+++ trunk/bibdesk/BDSKEditor.m  2025-07-18 09:21:33 UTC (rev 29291)
@@ -347,8 +347,7 @@
     return YES;
 }
 
-- (BOOL)validateCurrentEditedViewAndReturnError:(NSError **)error
-{
+- (BOOL)validateCurrentEditedViewAndReturnError:(NSError **)error {
     NSParameterAssert(currentEditedView);
     BOOL rv = ([[currentEditedView string] 
isStringTeXQuotingBalancedWithBraces:YES connected:NO]);
     if (NO == rv && error) {
@@ -359,8 +358,7 @@
     return rv;
 }
 
-- (void)discardEditing
-{
+- (void)discardEditing {
     if (editorFlags.isEditing == NO)
         return;
     
@@ -398,8 +396,7 @@
     [self setEditing:NO];
 }
 
-- (BOOL)commitEditing
-{
+- (BOOL)commitEditing {
     if (editorFlags.isEditing == NO)
         return YES;
     
@@ -445,8 +442,8 @@
     return YES;
 }
 
-- (BOOL)commitEditingAndReturnRecoverableError:(NSError **)error
-{
+// this can return a recoverable error, which we want for some methods but not 
for commitEditingAndReturnError
+- (BOOL)commitEditingAndReturnRecoverableError:(NSError **)error {
     if (editorFlags.isEditing == NO)
         return YES;
     
@@ -469,6 +466,7 @@
             editedRow = [tableView rowForView:textView];
         }
         
+        // first validate the text field or text view so we can return an 
error without presenting it
         if (textField) {
             
             NSString *string = [textView string];
@@ -495,7 +493,7 @@
         
                editorFlags.didSetupFields = NO; // if we we rebuild the 
fields, the selection will become meaningless
         
-        // commit edits (formatters may refuse to allow this)
+        // commit edits (formatters and validation methods should allow this 
at this point)
         if ([[self window] makeFirstResponder:[self window]] == NO) {
             // should not be reached, we should have found errors above
             if (error)
@@ -505,17 +503,15 @@
         
         // for inherited fields, we should do something here to make sure the 
user doesn't have to go through the warning sheet
                
-               if (editorFlags.didSetupFields == NO || editedRow == -1) {
-            if (editedRow != -1) {
-                if (editedRow < [tableView numberOfRows]) {
-                    [tableView editColumn:1 row:editedRow withEvent:nil 
select:NO];
-                    [(NSTextView *)[[self textFieldAtRow:editedRow] 
currentEditor] setSafeSelectedRanges:selection];
-                }
-            } else if ([[self window] makeFirstResponder:firstResponder]) {
-                if (textField)
-                    textView = (NSTextView *)[textField currentEditor];
-                [textView setSafeSelectedRanges:selection];
+        if (editedRow != -1) {
+            if (editorFlags.didSetupFields == NO && editedRow < [tableView 
numberOfRows]) {
+                [tableView editColumn:1 row:editedRow withEvent:nil select:NO];
+                [(NSTextView *)[[self textFieldAtRow:editedRow] currentEditor] 
setSafeSelectedRanges:selection];
             }
+        } else if ([[self window] makeFirstResponder:firstResponder]) {
+            if (textField)
+                textView = (NSTextView *)[textField currentEditor];
+            [textView 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

Reply via email to