mirror of
https://github.com/textmate/textmate.git
synced 2026-04-28 03:00:34 -04:00
Normalize newline and backspace characters in key event strings
The system’s key binding dictionaries use both CR and LF for newline and \x08 and \x7F for backspace.
This commit is contained in:
@@ -167,6 +167,11 @@ namespace ns
|
||||
std::string key; NSUInteger flags;
|
||||
parse_event_string(eventString, key, flags, true);
|
||||
|
||||
if(utf8::to_ch(key) == NSBackspaceCharacter)
|
||||
key = NSDeleteCharacter;
|
||||
else if(utf8::to_ch(key) == NSNewlineCharacter)
|
||||
key = NSCarriageReturnCharacter;
|
||||
|
||||
std::string modifierString = key.empty() ? "" : string_for(flags);
|
||||
if(startOfKey)
|
||||
*startOfKey = modifierString.size();
|
||||
|
||||
Reference in New Issue
Block a user