Skip to content

Commit

Permalink
1. Fixed issue #9(Support paste).
Browse files Browse the repository at this point in the history
  • Loading branch information
Nightonke committed Mar 17, 2017
1 parent c128147 commit 56fe580
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
4 changes: 2 additions & 2 deletions VHGithubNotifier/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0.1</string>
<string>1.0.2</string>
<key>CFBundleVersion</key>
<string>1010</string>
<string>1020</string>
<key>LSMinimumSystemVersion</key>
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
<key>LSUIElement</key>
Expand Down
22 changes: 22 additions & 0 deletions VHGithubNotifier/View/VHTextField.m
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,28 @@ - (BOOL)performKeyEquivalent:(NSEvent *)event
{
[self.textFieldDelegate onTextFieldEnterButtonClicked:self];
}

if (([event modifierFlags] & NSDeviceIndependentModifierFlagsMask) == NSCommandKeyMask)
{
// The command key is the ONLY modifier key being pressed.
if ([[event charactersIgnoringModifiers] isEqualToString:@"x"])
{
return [NSApp sendAction:@selector(cut:) to:[[self window] firstResponder] from:self];
}
else if ([[event charactersIgnoringModifiers] isEqualToString:@"c"])
{
return [NSApp sendAction:@selector(copy:) to:[[self window] firstResponder] from:self];
}
else if ([[event charactersIgnoringModifiers] isEqualToString:@"v"])
{
return [NSApp sendAction:@selector(paste:) to:[[self window] firstResponder] from:self];
}
else if ([[event charactersIgnoringModifiers] isEqualToString:@"a"])
{
return [NSApp sendAction:@selector(selectAll:) to:[[self window] firstResponder] from:self];
}
}

return [super performKeyEquivalent:event];
}

Expand Down

0 comments on commit 56fe580

Please sign in to comment.