keys.lua (was feature request: gui extensions)

From: Robert <ro....at.web.de>
Date: Fri, 17 Dec 2010 11:49:50 +0100

Hi Mitchell,
On Wed, Dec 15, 2010 at 3:54 PM, mitchell <c....at.caladbolg.net> wrote:
> Robert,
>
>> On Wed, Dec 15, 2010 at 3:23 PM, mitchell <c....at.caladbolg.net> wrote:
>>>
>>> Scott,
>>>
>>>> Also, I'd like to see the core Lua files partitioned further so that
>>>> it's easier to override functionality while leaving core routines
>>>> untouched. As an example, keys.lua could be split into key-handler.lua
>>>> and key-mappings.lua.
>>>
>>> This used to be the case, but it was changed. I tried finding the reason
>>> in
>>> the mailing list but I wasn't successful. Does anyone know where the
>>> discussion is?
>>>
>>
>> I don't remember, but couldn't the part below the "don't edit below
>> this line" simply be moved into the core module? This would it make
>> easier to provide for example a Scite-like keys.lua that could be
>> dropped into the .textadept directory.
>
> That means users have to copy all key commands to edit them and then keep
> track of changes between their keys.lua and textadept's keys.lua when a new
> version comes out. This is a pain (I have to do it because I use a
> completely different set of commands and don't want to load the default set
> and then clear it later during startup).
>
> The recommended way is to add or remove key commands specifically in user
> init.lua or a file that is 'require'd by user init.lua as stated in the
> manual.
>
> mitchell
>

attached is a "proof of concept" moving of the keypress handling to
the core module. I understand the recommended way but moving it would
simplify your life and those of others who have their very customized
key bindings, wouldn't it?

Additionaly, having KEYSYMS as a global table would be useful, too.
E.g. in find.lua there is
if code == 0xff1b then -- escape
which could be
if KEYSYMS[code] == 'esc' then

Now this isn't possible because keys.lua is loaded last, and in other
modules having _m.textadept.keys.KEYSYSMS[code] is not really much
better than writing a comment which explains the used key.

Robert

Received on Fri 17 Dec 2010 - 05:49:50 EST

This archive was generated by hypermail 2.2.0 : Thu 08 Mar 2012 - 11:57:46 EST