Escape can now be used to clear a recorded key equivalent

If there is no recorded key equivalent then the key is passed to super.
This commit is contained in:
Allan Odgaard
2014-09-02 20:43:20 +02:00
parent 74e9448738
commit 751a564fe2

View File

@@ -226,10 +226,10 @@ static NSString* const kRecordingPlaceholderString = @"…";
- (void)keyDown:(NSEvent*)anEvent
{
static std::set<std::string> const ClearKeys = { utf8::to_s(NSDeleteCharacter), utf8::to_s(NSDeleteFunctionKey) };
static std::set<std::string> const ClearKeys = { utf8::to_s(NSDeleteCharacter), utf8::to_s(NSDeleteFunctionKey), "\e" };
static std::set<std::string> const RecordingKeys = { " " };
std::string const keyString = to_s(anEvent);
if(ClearKeys.find(keyString) != ClearKeys.end())
if(ClearKeys.find(keyString) != ClearKeys.end() && !OakIsEmptyString(self.eventString))
[self clearKeyEquivalent:self];
else if(RecordingKeys.find(keyString) != RecordingKeys.end())
self.recording = YES;