Re: [textadept] Caps Lock (Was: Textadept 2.2 Beta 2)

From: Robert <ro....at.web.de>
Date: Mon, 12 Jul 2010 09:50:38 +0200

On Sat, Jul 10, 2010 at 4:51 PM, mitchell <c....at.caladbolg.net> wrote:
> On Fri, 9 Jul 2010, Robert wrote:
>
>> On Fri, Jul 9, 2010 at 5:35 AM, mitchell <c....at.caladbolg.net> wrote:
>> [snip]
>>>>
>>>> No keypresses are accepted until you press caps lock again.
>>>> I also found that there is a gdk_keymap_get_caps_lock_state function
>>>> [1].
>>>> Mitchell, could this possibly be included?
>>>
>>> Your Lua code or gdk_keymap_get_caps_lock_state? The Lua code should go
>>> on
>>> the wiki.
>>>
>>> mitchell
>>>
>> The latter, my caps lock function has the disadvantage that it does
>> not work when caps has already been pressed before starting Textadept
>> - having the actual state would be better.
>
> Perhaps someone familiar with this problem should submit a patch. The
> appropriate code is in src/textadept.c:432 (s_keypress).
> gdk_keymap_get_caps_lock_state could be called, and based on that, the
> event->state's GDK_SHIFT_MASK can be modified (if I understand the problem
> correctly).
>
> mitchell
>

This could be a Lua only workaround:

events.connect('keypress',
  function(code, shift, control, alt)
    if not shift and code > 64 and code < 91 then
      gui.statusbar_text = "CAPS LOCK"
      return true
    else
      return
    end
  end, 1)

I'm not sure how to change the s_keypress function, another state
probably? But maybe the above event is good enough.

Robert
Received on Mon 12 Jul 2010 - 03:50:38 EDT

This archive was generated by hypermail 2.2.0 : Thu 08 Mar 2012 - 11:50:19 EST