Re: Key bindings

From: mitchell <mforal.n....at.gmail.com>
Date: Thu, 28 Jan 2010 08:15:57 -0800 (PST)

Rob,

> > If you could maybe compile a list of changes, they could probably be
> > added to the default key_commands.lua shipped with ta.
>
> I can surely do that, but I think the problem is that with the current
> implementation the key bindings work only for one layout at a time.
> Would it be possible not to have the shift key as a modifier and
> simply use something like:
> keys.cs  = { 'save', b      }
> keys.cS = { 'save_as', b   }
> instead off
> keys.cs  = { 'save', b      }
> keys.css = { 'save_as', b   }
>
> Lua is case-sensitive, isn't it?

The way Lua is notified of a key command is the keycode followed by
ctrl, shift, and alt modifiers. Here is the relevant snippet from core/
ext/keys.lua:

  if code < 256 then
    key = string_char(code):lower()
    -- [snip]
  else
    if not KEYSYMS[code] then return end
    key = KEYSYMS[code]
  end
  control = control and CTRL or ''
  shift = shift and SHIFT or ''
  alt = alt and ALT or ''
  local key_seq = string_format('%s%s%s%s', control, shift, alt, key)

key_seq is the index to the table.

I don't know a more flexible way to do it without increasing
computational time.

> You may have your own key_commands.lua in ~/.textadept. Keep in mind
> > if it exists, the key_commands.lua in core/ext/ will NOT be loaded
> > first.
>
> The alternative would be to have key_commands.lua available for
> download for different keyboard layouts.

Right, which seems kind of odd...

This problem is certainly worth looking into.

Mitchell

>
> Robert
Received on Thu 28 Jan 2010 - 11:15:57 EST

This archive was generated by hypermail 2.2.0 : Thu 08 Mar 2012 - 11:38:58 EST