Re: General questions about snippets and their behaviour

From: <briancsch....at.gmail.com>
Date: Thu, 8 Apr 2010 17:28:25 -0700 (PDT)

On Apr 8, 4:00 pm, phayz <russelldicken....at.gmail.com> wrote:
> I have some general questions about Textadept's snippets -
>
> (1) In the CPP snippets file provided with Textadept, the snippets
> themselves are surrounded by single quote marks ('), but the XML
> snippets are surrounded by double quote marks ("). Is there a specific
> reason for this difference?

I come from a C++ background and prefer using double quotes for
strings and single quotes for characters. There really isn't a big
difference. Many of your questions would be answered by reading the
Lua manual: http://www.lua.org/manual/5.1/manual.html. Snippet files
are actually Lua code.

> In a hypertext snippets file created by Brian Schott, he escapes
> double quotes with a backslash (e.g. \" ) and I wonder, if the
> snippets were surrounded by single quote marks and not double quote
> marks, would the double quote marks still have to be escaped with a
> backslash?
>
> (2) In a hypertext snippets file created by Brian Schott, he has
> double square brackets (i.e. [[ and ]]) surrounding some snippets and
> I wonder why. What is the significance of the double square brackets?

It's a multi-line string. I need to get around to converting more of
my snippets to use those to make things more clear.

> (3) Now that I have hypertext snippets working, I have done a little
> testing of Brian's hypertext snippets. I type 'ahr' and press [Tab]
> and, as if by magic, the snippet's replacement text is inserted.
> Fantastic! I then carry on editing the file further on, but the empty
> line immediately below the inserted text remains a horrible mustard
> colour. I don't mean to disparage mustard as a colour in general
> (although it *IS* quite disgusting) but I don't understand why the
> highlight remains.
>
> I did a little more testing before sending this and I have some more
> information. The 'ahr' snippet contains placeholders '%1' and '%0' and
> the highlight remains if I don't type text in the snippet's
> replacement text where the '%1' placeholder appears. If I go back to
> the text inserted by the snippet and DO type some text in there, the
> highlighted, blank line disappears. If I put the cursor on this
> highlighted, blank line, and press [Tab], the highlight disappears and
> the cursor is moved to the position in the snippet's replacement text
> where the '%0' placeholder appears.

In general you should keep pressing the tab key until the snippet is
done, not just use the arrow keys or mouse to move it. When all the
tab stops have been hit that "mustard" line should go away. It's a
bookmark set to indicate the end of a snippet.

I wrote a snippet introduction here: http://caladbolg.net/textadeptwiki/index.php?n=Main.Snippets.

- Brian

> Regards,
>
> Russell Dickenson
>
> --
> You received this message because you are subscribed to the Google Groups "textadept" group.
> To post to this group, send email to textadept.at.googlegroups.com.
> To unsubscribe from this group, send email to textadept+unsubscribe.at.googlegroups.com.
> For more options, visit this group athttp://groups.google.com/group/textadept?hl=en.
Received on Thu 08 Apr 2010 - 20:28:25 EDT

This archive was generated by hypermail 2.2.0 : Thu 08 Mar 2012 - 11:42:50 EST