Re: General questions about snippets and their behaviour

From: phayz <russelldicken....at.gmail.com>
Date: Thu, 8 Apr 2010 18:32:33 -0700 (PDT)

On Apr 9, 10:28 am, "briancsch....at.gmail.com" <briancsch....at.gmail.com>
wrote:
> 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

Brian,

Thanks for all that information. I am still getting used to the fact
that Textadept is largely Lua code. In future I'll be sure to refer to
the Lua manual before asking questions like this again.

Thanks also for your introduction to Snippets on the Textadept wiki. I
have read it through, but perhaps I haven't taken it all in. Mitchell
does a great job of documenting Textadept, but your additional
information about snippets is excellent!

I'm at a point with Textadept that I'm getting excited, which is a
sure sign I'm a geek. The easy extensibility of Textadept is great but
the fact that it's also easily understood is also great. I hope to
soon make a few contributions to the wiki.

Regards,

Russell Dickenson
Received on Thu 08 Apr 2010 - 21:32:33 EDT

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