Re: [code] Feature request: snippet._insert should allow replacing the selection

From: Mitchell <m.att.foicica.com>
Date: Fri, 7 Apr 2017 12:26:34 -0400 (EDT)

Hi Pedro,

On Fri, 7 Apr 2017, Pedro Andres Aranda Gutierrez wrote:

> In my limited understanding, the main problem is that the code currently
> doesn't distinguish between snippet triggered with the '\t' key and snippet
> triggered from the menu or from calling textadept.snippets._insert() in
> some Lua code. My main limitation is that I'm not proficient enough in Lua
> to understand the implementation and propose fixes... still learning...

Every time you press a key, `core/keys.lua` sees if there's a function
assigned to that key. If so, that function is run, and the key is
generally not handled any further. With regard to snippets, '\t' is bound
to `textadept.snippets._insert()`, so it really is indistinguishable from
a menu or user call to `textadept.snippets._insert()`. (The only
difference is that `core/keys.lua` is the one calling that function, as
opposed to the menu or user code).

I have a suspicion that the snippet sentinel is not being set properly (or
is being overwritten) only when the entire line is selected.

Cheers,
Mitchell

-- 
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 07 Apr 2017 - 12:26:34 EDT

This archive was generated by hypermail 2.2.0 : Sat 08 Apr 2017 - 06:49:50 EDT