Re: [textadept] Re: feature request: gui extensions

From: mitchell <c....at.caladbolg.net>
Date: Wed, 15 Dec 2010 09:23:14 -0500 (Eastern Standard Time)

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?

> As a related question, can I override one of the core files by placing
> it somewhere in my .textadept dir? Where would I put it?

Core files are not to be overwritten for good reason. If you really want
to, you have to modify core/init.lua to put _USERHOME..'/core/?.lua;'
in package.path before the _HOME..'/core/?.lua'. Then you can create a
core/ directory in your .textadept/ folder and put files there.
Potentially dangerous though.

> Another question related to event handlers. Does Lua "chain" the
> handlers, so all registered handlers for an event are invoked?

Yes.

> If your
> custom handler wants to decline processing an event, how do you
> indicate that the next handler should be invoked?

There are plenty of examples in the existing handlers. Basically:

if [boolean] then
   -- handler code
   -- ...
end

The next handler is automatically invoked.

> How do you prevent
> the next handler from being invoked?

Return a boolean value from your handler. The 'keypress' handler returns
true if it successfully executes a key command and false if there is an
error so Scintilla won't handle the keypress (like inserting a character).

mitchell
Received on Wed 15 Dec 2010 - 09:23:14 EST

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