Revision: 28855
          http://sourceforge.net/p/bibdesk/svn/28855
Author:   hofman
Date:     2024-04-06 22:40:48 +0000 (Sat, 06 Apr 2024)
Log Message:
-----------
stricter check for modifier flags for key equivalent

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

Modified: trunk/bibdesk/BDSKTextImportItemTableView.m
===================================================================
--- trunk/bibdesk/BDSKTextImportItemTableView.m 2024-04-06 21:14:57 UTC (rev 
28854)
+++ trunk/bibdesk/BDSKTextImportItemTableView.m 2024-04-06 22:40:48 UTC (rev 
28855)
@@ -80,40 +80,37 @@
 - (BOOL)performKeyEquivalent:(NSEvent *)theEvent{
     
     unichar c = [theEvent firstCharacter];
-    NSUInteger flags = [theEvent modifierFlags];
+    NSUInteger flags = [theEvent standardModifierFlags];
     
-    if (flags & NSEventModifierFlagCommand) {
-        
-        if (c >= '0' && c <= '9') {
-        
-            NSUInteger idx = c == '0' ? 9 : (NSUInteger)(c - '1');
-            if (flags & NSEventModifierFlagOption)
-                idx += 10;
-            BOOL rv = [self performActionForRow:idx];
-            if (temporaryTypeSelectMode)
-                [self endTemporaryTypeSelectMode];
-            return rv;
-        
-        } else if (temporaryTypeSelectMode) {
-        
-            if (c == NSTabCharacter || c == BDSKEscapeCharacter) {
-                [self endTemporaryTypeSelectMode];
-            } else if (c == NSCarriageReturnCharacter || c == NSEnterCharacter 
|| c == NSNewlineCharacter) {
-                [self endTemporaryTypeSelectMode];
-                [self performActionForRow:[self selectedRow]];
-            }
-            if (temporaryTypeSelectMode == NO) {
-                NSInteger row = [self selectedRow];
-                if (row != -1)
-                    [self editColumn:2 row:row withEvent:nil select:YES];
-                return YES;
-            }
-        
-        } else if (c == '=') {
-        
-            [self startTemporaryTypeSelectMode];
+    if ((c >= '0' && c <= '9') && (flags & ~NSEventModifierFlagOption) == 
NSEventModifierFlagCommand) {
+    
+        NSUInteger idx = c == '0' ? 9 : (NSUInteger)(c - '1');
+        if (flags & NSEventModifierFlagOption)
+            idx += 10;
+        BOOL rv = [self performActionForRow:idx];
+        if (temporaryTypeSelectMode)
+            [self endTemporaryTypeSelectMode];
+        return rv;
+    
+    } else if (temporaryTypeSelectMode && flags == NSEventModifierFlagCommand) 
{
+    
+        if (c == NSTabCharacter || c == BDSKEscapeCharacter) {
+            [self endTemporaryTypeSelectMode];
+        } else if (c == NSCarriageReturnCharacter || c == NSEnterCharacter || 
c == NSNewlineCharacter) {
+            [self endTemporaryTypeSelectMode];
+            [self performActionForRow:[self selectedRow]];
+        }
+        if (temporaryTypeSelectMode == NO) {
+            NSInteger row = [self selectedRow];
+            if (row != -1)
+                [self editColumn:2 row:row withEvent:nil select:YES];
             return YES;
         }
+    
+    } else if (c == '=' && (flags & ~NSEventModifierFlagShift) == 
NSEventModifierFlagCommand) {
+    
+        [self startTemporaryTypeSelectMode];
+        return YES;
     }
     
     return [super performKeyEquivalent:theEvent];

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