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

From: Mitchell <m.att.foicica.com>
Date: Mon, 17 Apr 2017 20:53:59 -0400 (EDT)

Hi Pedro,

On Mon, 17 Apr 2017, Pedro Andres Aranda Gutierrez wrote:

> Happy Easter to everybody!
>
> I have been giving this issue a thought and I think that we may need to
> split treatments depending on whether it is the Tab key or not that calls
> the function. Something like:
>
> When tab is pressed, we execute the following function
>
> get the word before the cursor and try to find a snippet
> if found:
> kill the word before the trigger
> execute the snippet associated to the word
> else:
> insert a tab

Okay, the Tab key is already bound to a function that does this very
thing.

> When we bind a key to a snippet, then we only execute the snippet
> associated to the word we indicate in the code

I can bind a key to `function() snippets._insert(snippet_text) end` and it
works as I expected (except for some cases of selected text as pointed out
earlier in this thread).

I'm having trouble understanding where Textadept is falling short in your
opinion (other than the bug that I have not had the time to look into yet,
sorry).

> Would that kill recursive snippets?

I'm not sure what you mean be recursive. Perhaps nested? If so, no that
would not kill nested snippets -- it would just add another one to the
stack.

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 Mon 17 Apr 2017 - 20:53:59 EDT

This archive was generated by hypermail 2.2.0 : Tue 18 Apr 2017 - 06:52:27 EDT