[code][textadept] layout invariant shortcuts

From: Heck Fy <shitpoet.att.gmail.com>
Date: Mon, 12 Sep 2016 07:09:45 +0300

hello!

the problem:
ctrl+z is ctrl+я in russian keyboard layout, so when i try to undo
(typing in russian layout) nothing happens

i found a workaround:

```
local ru_codes = {
  1734, 1737, 1747, 1751, 1749, 1729,
  1744, 1746, 1755, 1743, 1740, 1732,
  1752, 1748, 1757, 1754, 1738, 1739,
  1753, 1733, 1735, 1741, 1731, 1758,
  1742, 1745 }
local en_code = 97
for k,v in pairs(ru_codes) do
  keys.KEYSYMS[v] = string.char(en_code)
  en_code = en_code + 1
end
```

but it is language dependent .

i suggest to add language agnostic fix to `s_keypress` function in
`textaadept.c`:

#if GTK
/** Signal for a Scintilla keypress. */
static int s_keypress(GtkWidget*_, GdkEventKey *event, void*__) {
  if (event->group && (event->state &
(GDK_CONTROL_MASK|GDK_MOD1_MASK|GDK_META_MASK))) {
    gdk_keymap_translate_keyboard_state(gdk_keymap_get_default(),
event->hardware_keycode, (GdkModifierType)0, 0, &event->keyval, NULL,
NULL, NULL);
  }
  return lL_event(lua, "keypress", LUA_TNUMBER, event->keyval, event_mod(SHIFT),
                  event_mod(CONTROL), event_mod(MOD1), event_mod(META), -1);
}

- if there are modifiers (excluding `shift`), we translate non-latin
letters to latin (f.ex. Я -> Z).

something like this, i tested to compile ta 8.6 with this change, and
it works well ]

may be it is more reliable to do even this --
https://lists.fedoraproject.org/pipermail/scm-commits/Week-of-Mon-20131118/1148648.html
 - but it may be redundant in most cases. i know at least that on my
system latin group is always equals to zero.

-- 
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 Mon 12 Sep 2016 - 00:09:45 EDT

This archive was generated by hypermail 2.2.0 : Mon 12 Sep 2016 - 06:43:05 EDT