From 751a564fe236fdcb0150871abf12de25d04ee378 Mon Sep 17 00:00:00 2001 From: Allan Odgaard Date: Tue, 2 Sep 2014 20:43:20 +0200 Subject: [PATCH] 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. --- Frameworks/OakAppKit/src/OakKeyEquivalentView.mm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Frameworks/OakAppKit/src/OakKeyEquivalentView.mm b/Frameworks/OakAppKit/src/OakKeyEquivalentView.mm index 37e0d704..3014b1a2 100644 --- a/Frameworks/OakAppKit/src/OakKeyEquivalentView.mm +++ b/Frameworks/OakAppKit/src/OakKeyEquivalentView.mm @@ -226,10 +226,10 @@ static NSString* const kRecordingPlaceholderString = @"…"; - (void)keyDown:(NSEvent*)anEvent { - static std::set const ClearKeys = { utf8::to_s(NSDeleteCharacter), utf8::to_s(NSDeleteFunctionKey) }; + static std::set const ClearKeys = { utf8::to_s(NSDeleteCharacter), utf8::to_s(NSDeleteFunctionKey), "\e" }; static std::set 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;