Skip to content
Snippets Groups Projects
Commit 4f626513 authored by George Nachman's avatar George Nachman
Browse files

Accept dead keys as hotkeys. Issue 6102.

This fixes both deadkeys alone (e.g., ` on a DE keyboard) or deadkey+key (opt+` on DE to give '). I tested migration from 3.0 and it seems fine.
parent 6dabbd29
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -56,7 +56,7 @@
 
- (BOOL)hotKeyAssigned {
BOOL hasAlternate = [self.alternateShortcuts anyWithBlock:^BOOL(iTermShortcut *shortcut) {
return shortcut.charactersIgnoringModifiers.length > 0;
return shortcut.charactersIgnoringModifiers.length > 0 || shortcut.characters.length > 0 || shortcut.keyCode != 0;
}];
return (_primaryShortcut.isAssigned ||
self.hasModifierActivation ||
Loading
Loading
Loading
Loading
@@ -187,11 +187,16 @@ const NSEventModifierFlags kHotKeyModifierMask = (NSCommandKeyMask |
}
 
- (NSString *)stringValue {
return self.charactersIgnoringModifiers.length > 0 ? [iTermKeyBindingMgr formatKeyCombination:self.identifier keyCode:self.keyCode] : @"";
// Dead keys can have characters without charactersIgnoringModifiers. For example, option+` on
// a German keyboard enters an apostrophe ('). The ` key is a dead key, so if you ignore modifiers
// it's nothing. So if there are either characters or characters ignoring modifiers, it's a
// formattable shortcut. If you press just the dead key then both characters and charactersIgnoringModifiers
// will be empty.
return (self.charactersIgnoringModifiers.length > 0 || self.characters.length > 0 || self.keyCode != 0) ? [iTermKeyBindingMgr formatKeyCombination:self.identifier keyCode:self.keyCode] : @"";
}
 
- (BOOL)isAssigned {
return self.charactersIgnoringModifiers.length > 0;
return self.charactersIgnoringModifiers.length > 0 || self.characters.length > 0 || self.keyCode != 0;
}
 
- (iTermHotKeyDescriptor *)descriptor {
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment