Re: [code] [textadept] Is there a way to enclose text in Snippets?

From: cryo shock <axteffekt.att.gmail.com>
Date: Thu, 23 Mar 2017 22:12:27 +0100

That's strange, I just tested it. In my case it really makes a difference
whether I put %0 alone or together %0%1.

snippets.context['emph'] = '{\\em %0<selected_text>}' -- cursor jumps
behind }
snippets.context['emph'] = '{\\em %0%1<selected_text>}' -- cursor jumps in
front of }

The problem then again is, that with %0%1 enclosing a highlighted text ends
up deleting the highlighted text.

Furthermore, the enclosion of text seems to work with %0 only. %1 deletes
the text

2017-03-23 22:00 GMT+01:00 Robert Gieseke <rob.g.att.web.de>:

> Am 23/03/17 um 19:22 schrieb cryo shock:
> > There is another thing I should mention to be complete:
> >
> > when a snippet looks like this (the way initially described):
> >
> > snippets.context['emph'] = '{\\em %0<selected_text>}'
> >
> > then snippets work as expecten when you paste them over highlighted
> > text. BUT when you use the very same snippet without highlighted text,
> > then the cursor jumps to the end of the snippet, and not like expected
> > to the %0 placeholder. So what I had to to is: add a second placeholder
> > to the snippet:
> >
> > snippets.context['emph'] = '{\\em %0%1<selected_text>}'
> >
> > But I am sure that this will lead to undesired results with snippets
> > that contain multiple placeholders...
>
> Hm, don't know whether this could be considered a bug, maybe %0 can only
> be "standalone".
>
> But your workaround doesn't seem to work for me ...
>
> Cheers,
> Robert
> --
> 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 Thu 23 Mar 2017 - 17:12:27 EDT

This archive was generated by hypermail 2.2.0 : Fri 24 Mar 2017 - 06:54:21 EDT