diff --git a/AppController.h b/AppController.h index 669bed8..38a54a2 100755 --- a/AppController.h +++ b/AppController.h @@ -35,6 +35,7 @@ SRKeyCodeTransformer *srTransformer; BOOL isBezelDisplayed; BOOL isBezelPinned; + NSTimeInterval lastPasteFromStackTime; NSString *currentKeycodeCharacter; NSDateFormatter* dateFormat; diff --git a/AppController.m b/AppController.m index 3898ab0..c69e45b 100755 --- a/AppController.m +++ b/AppController.m @@ -883,6 +883,14 @@ - (void)restoreStashedStoreAndUpdate - (void)pasteFromStack { NSLog(@"pasteFromStack called"); + // Releasing the modifier keys and pressing Return within a fraction of a second + // both trigger a paste, so the same bezel selection would be pasted twice. + NSTimeInterval now = [NSDate timeIntervalSinceReferenceDate]; + if ( now - lastPasteFromStackTime < 0.6 ) { + NSLog(@"pasteFromStack ignored - duplicate trigger within 0.6s"); + return; + } + lastPasteFromStackTime = now; NSString *content = [flycutOperator getPasteFromStackPosition]; if ( nil != content ) { NSLog(@"Content found, adding to pasteboard and preparing to paste: %@", [content substringToIndex:MIN(content.length, 50)]);