Re: [code] [textadept] Hotkeys in other locale

From: A.M. Genaev <genaev.att.nioch.nsc.ru>
Date: Thu, 19 Sep 2013 20:44:49 +0700

Hi,

Sorry for long delay.

Thank you very mach for detailed explanation.

I hope the next code will be usefull for other russian users.

-- Shortcuts with non-capital russian letters
-- explanation see http://foicica.com/lists/code/201309/1152.html

--
-- non-locale symbols corresponding to russian letters
--      for  (key codes 1728-1759)
local en = ".f,wltau[bqrkvyjgzhcne;dmspi'ox]"
for i = 1, string.len(en) do
  _G.keys.KEYSYMS[1727+i] = string.sub(en,i,i)
end
_G.keys.KEYSYMS[1699] = "`"  -- for 
Cheers,
Alexander
On Wed, 04 Sep 2013 16:10:08 +0200
Robert Gieseke <rob.g.att.web.de> wrote:
> Hi,
> 
> Am 9/4/13 12:49 PM, schrieb A.M. Genaev:
> > Hi,
> >
> > The most of key bindings doesn't work when i switch to Russian.
> > Is there a way to do hotkeys to be locale-independent?
> >
> 
> As Mitchell wrote Textadept doesn't use key codes but chars.
> You could try the following hack to use the same keybindings.
> 
> Textadept has the keys.KEYSYMS table to look up key codes greater than 
> 255 (it's in core/keys.lua). You could add mappings from the Cyrillic 
> letters to the Latin ones used in short cuts.
> 
> An example:
> When I switch to a Russian layout and press 's' I get ''.
> 
> In my 'init.lua' I put
> _G.keys.KEYSYMS[1753] = 's'
> 
> Now I can press the 'Ctrl s' or 'Cmd s' shortcuts and get the expected 
> behaviour, without the modifier it's still yery, ''.
> 
> To get the key code you can comment out the first print statement in the 
> keypress function in core/keys.lua. I think these numbers are GTK 
> specific so you could look them up, I've found this table for PyGTK with 
> Hex representations:
> https://github.com/nzjrs/pygtk/blob/master/gtk/keysyms.py#L827
> ...
> I hope this wasn't a too confusing explanation :-)
> Cheers,
> Robert
-- 
A.M. Genaev <genaev.att.nioch.nsc.ru>
-- 
You are subscribed to code.att.foicica.com.
To change subscription settings, send an e-mail to code+help.att.foicica.com.
To unsubscribe, send an e-mail to code+unsubscribe.att.foicica.com.
Received on Thu 19 Sep 2013 - 09:44:49 EDT

This archive was generated by hypermail 2.2.0 : Fri 20 Sep 2013 - 06:40:10 EDT