[TxMt] Re: Keyboard shortcuts not working in non-English layouts

Allan Odgaard mailinglist at textmate.org
Sun Jan 18 13:05:04 UTC 2015


On 16 Jan 2015, at 0:49, Igor K wrote:

> Most of the shortcuts are not working when I have Russian keyboard 
> layout active.
> […]

It would be all the shortcuts that do not use command (⌘). You should 
find that NSTextView has the same problem, for example ⌃A / ⌃E 
should move to begin/end of line, but with Russion key map it will not 
do that (nor does any of the other system defined key bindings with 
control seem work).

The reason command works is because Apple change the mapping back to 
Latin for this key. So ⌘ц is seen by applications as ⌘W, but such 
mapping is not done for control (⌃) so ⌃ц is just ⌃ц.

> I think that everything that resides in the upper menu works with any 
> layout,
> everything else works only when using English layout for me.

Apple has some advanced heuristic for mapping key equivalents to menu 
actions, but it’s not available for third parties to use (or 
NSTextView, it would seem).

I updated my own heuristic so that when control is down, and the result 
from the system is a non-ASCII character, then I will ignore the current 
keyboard mapping and use the virtual key code to get the character that 
would appear on a US keyboard.

This is a bit dirty (translating a virtual key code to a character using 
my own table), but since it is only done when control is down *and* the 
system translates the key event to a non-ASCII character, I don’t 
think it will break any existing desired behavior.


More information about the textmate mailing list