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

From: Pedro Andres Aranda Gutierrez <paaguti.att.gmail.com>
Date: Thu, 20 Apr 2017 08:15:33 +0200

Hi Mitchelk,

thanks a lot for the work. I've started to test the new snippets.lua file
and, until now, it fixes the duplication issues. I can now use the snippets
using the trigger word and Tab, from the menu and using an assigned key
sequence.

Best, /PA

PS: Since it is mentioned in the thread, I remember having had troubles in
the past with the Del key in a snippet. However I'll keep silent on this,
because I don't have any example I can reproduce. But I'll be more alert on
this one.

On 19 April 2017 at 03:43, Mitchell <m.att.foicica.com> wrote:

> Hi,
>
> On Tue, 18 Apr 2017, cryo shock wrote:
>
> Hi guys,
>>
>> I think, when Mitch finds the time to solve the problem with selected_text
>> and *appending* or *replacing*, then your problem will be solved Pedro.
>>
>
> Yes, I think I identified the issue and committed a fix[1]. Testing
> Pedro's snippets from his original screenshot seems to work fine.
>
> I'd also like to remind what I experienced so far:
>>
>> Instead of replacing, a snippet with selected_text gets appended after the
>> highlighted text
>>
>> - problem is not occuring for a whole line only; it also happens for
>> single
>> words
>>
>
> Okay, I think this has been fixed. It seems to only happen when the caret
> position is at the end of a selection. If it is at the beginning of the
> selection, I was not able to reproduce the problem.
>
> - there seems to be a difference in using %selected_text while
>> -- pasting snippets directly after each other
>> -- on the contrary to pasting a snippet, then writing some text, then
>> pasting a snippet again
>>
>
> Do you have an example? Sorry, but I don't see one in the e-mail chain.
>
> - problem might also have to do with *placeholders*
>> -- personally I think, there might be a problem with the jump from %1 to
>> %0, or with %n while n>=1 in general
>> --- I think that, because there seems to happen an unexpected jump, when
>> you *delete* a placeholder, without jumping there by using *Tab*-key
>> before. I.e.: although there is no more placeholder, TA jumps to the
>> beginning of the document and deletes the first symbol.
>> ---- To clearify: when creating a snippet with placeholders, you can not
>> assume, that the user will always use those placeholders. That counts for
>> me. Sometimes after pasting a snippet I just use arrow keys to go down a
>> line and delete (most of the time) the %0 placeholder by using
>> Backspace-key. Then an unexpected event happens: when I use Tab-key again
>> to create a simple Tab break, the cursor jumps to the first line of the
>> buffer and deletes the first symbol.
>> For example, CTX starts its docs with
>>
>> \starttext
>>
>> When I do as described above, then the first line looks like this ( _ is
>> the cursor position after using Tab):
>>
>> _starttext
>>
>
> Again, an example would help me identify the issue. Textadept uses
> invisible markers for snippet boundaries and placeholders. If you are
> backspacing in all sorts of places while a snippet is running, you are
> probably asking for trouble, as I didn't envision that's how snippets are
> used.
>
> Cheers,
> Mitchell
>
> [1]: http://foicica.com/hg/textadept/rev/36380e1c98f7
>
> --
> 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.
>
>

-- 
Fragen sind nicht da um beantwortet zu werden,
Fragen sind da um gestellet zu werden
Georg Kreisler
-- 
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 Thu 20 Apr 2017 - 02:15:33 EDT

This archive was generated by hypermail 2.2.0 : Thu 20 Apr 2017 - 06:32:21 EDT