Caps Lock (Was: Textadept 2.2 Beta 2)

From: Robert <ro....at.web.de>
Date: Wed, 7 Jul 2010 14:16:51 +0200

On Tue, May 4, 2010 at 11:45 AM, Robert <ro....at.web.de> wrote:
> On Tue, May 4, 2010 at 2:34 AM, mitchell <mforal.n....at.gmail.com> wrote:
>> Brian,
>>
>> On May 1, 4:27 pm, Brian Schott <briancsch....at.gmail.com> wrote:
>>> I've found a very minor bug. When pressing Control + S with the Caps
>>> Lock key pressed, Textadept interprets this as "Save As" instead of
>>> "Save". This is likely due to the way the key commands were changed a
>>> while back to deal with more keyboard layouts.
>>
>> A minor cosmetic issue if anything. I can't think of a good fix off
>> the top of my head.
>>
>> Mitchell
>>
>>>
>
> Brian, as a workaround you could remap your caps lock key to another
> control key.
> On OS X there is a preference pane somewhere, on Linux I use
> setxkbmap  -option ctrl:nocaps
> I prefer this and it does not matter where the function key is :-)
>
> Robert
>

The problem with doing this is when working on another machine where I
can't remap the caps lock key (ctrl-W closes all buffers...)
I now have this in my init.lua:
-- Caps Lock Catcher
events.connect('keypress', function(code, shift, control, alt)
  if code == 16777215 then
    gui.statusbar_text = "Caps Lock."
    block = events.connect('keypress', function(code, shift, control, alt)
      if code == 16777215 then
        events.disconnect('keypress', block)
        gui.statusbar_text = ''
        return true
      else
        return true
      end
    end, 1)
    return true
  end
end, 1)

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?

[1] http://library.gnome.org/devel/gdk/stable/gdk-Keyboard-Handling.html#gdk-keymap-get-caps-lock-state

Robert
Received on Wed 07 Jul 2010 - 08:16:51 EDT

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