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

From: Mitchell <m.att.foicica.com>
Date: Fri, 24 Mar 2017 13:54:36 -0400 (EDT)

Hi Sebastian,

On Thu, 23 Mar 2017, cryo shock wrote:

> 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>}'

Use `snippets.context['emph'] = '{\\em %0%<selected_text>}'. (Note the
omission of 1 since you want to insert selected text immediately upon
insertion, not make it a placeholder.)

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 24 Mar 2017 - 13:54:36 EDT

This archive was generated by hypermail 2.2.0 : Sat 25 Mar 2017 - 06:28:26 EDT