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

From: cryo shock <axteffekt.att.gmail.com>
Date: Sun, 9 Apr 2017 23:06:54 +0200

I just wanted to add, that this not only happens when the whole line is
selected.
It happens to me even on single words. Point is, that it's not happening
all the time, only sometimes. Which makes it very difficult to recreate.
I noticed that it happened to me when I used line wrapping / folding. I
will try without code folding in the next few days to see whether I am
mistaken.
Furthermore I can imagine trouble with code folding, difference between
selecting text with mouse and keyboard, multiple snippets within a single
line (code folding), multiple snippets in a specific time or order (kind of
a buffer problem)...

I really hope that we can locate and eliminate this "bug". It's really
annoying to notice in the output that there is a duplicate text.

Cheers, Sebastian

2017-04-07 18:26 GMT+02:00 Mitchell <m.att.foicica.com>:

> 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.
>
>

-- 
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 Sun 09 Apr 2017 - 17:06:54 EDT

This archive was generated by hypermail 2.2.0 : Mon 10 Apr 2017 - 06:32:30 EDT