Re: [code] [textadept] Key Modes

From: Chris Emerson <c-ta.att.mail.nosreme.org>
Date: Fri, 19 Apr 2013 18:03:16 +0100

Hi Mitchell,

On Fri, Apr 12, 2013 at 12:26:19PM -0400, Mitchell wrote:
> Textadept hg[1] now has key modes.

Great! That simplifies my key bindings.

One detail that would be nice to tweak in command_entry:

> (By default, `Esc` is pre-defined to exit any command entry mode.)

Unfortunately this also forces keys.MODE to nil, but I'd like to control
which mode it goes to.

How about something along these lines?

diff -r 0069633878e2 modules/textadept/command_entry.lua
--- a/modules/textadept/command_entry.lua Mon Apr 15 19:26:43 2013 -0400
+++ b/modules/textadept/command_entry.lua Fri Apr 19 17:56:07 2013 +0100
@@ -52,7 +52,7 @@
 -- @name enter_mode
 function M.enter_mode(mode)
   keys.MODE = mode
- if mode then keys[mode]['esc'] = M.enter_mode end
+ if mode and keys[mode]['esc'] == nil then keys[mode]['esc'] = M.enter_mode end
   -- In curses, M.focus() does not return immediately, so the key sequence that
   -- called M.focus() is still on the keychain. Clear it.
   if CURSES then keys.clear_key_sequence() end

Best regards,

Chris

-- 
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 Fri 19 Apr 2013 - 13:03:16 EDT

This archive was generated by hypermail 2.2.0 : Sat 20 Apr 2013 - 06:41:50 EDT