Re: [gedit-list] Documentation for snippets plugin



Op do, 24-08-2006 te 18:16 +0100, schreef Joachim Noreiko:
> > > That's the bit I don't understand -- what does
> > > 'finalized' mean?
> > > Is it simply that the Tab key will revert to
> > inserting
> > > tab characters?
> > 
> > You could say that. All the placeholders are
> > removed. At a more
> > technical note (to clear things up): what happens
> > when you insert a
> > snippet is that certain marks are placed in the text
> > to identify
> > placeholders and such. Certain actions are taken
> > when you enter or leave
> > a placeholder or when you change the contents of a
> > placeholder. When the
> > snippet is finalized all these marks and the
> > corresponding actions are
> > removed and the plugin doesn't do anything special
> > with that text
> > anymore. I hope this makes it somewhat more clear
> > what actually happens
> > and what the consequences are.
> 
> So... in terms that an everyday user understands, 'the
> text stops being magic'.

Indeed.

> 
> > > I'm also not sure about $GEDIT_CURRENT_WORD. Is it
> > > implemented in 2.14.3? I can't get the example
> > from
> > > the  wiki page to do anything.
> > 
> > This has been added in 2.15.1 and I don't think it
> > has been backported
> > to 2.14. It will be included in 2.16 though.
> 
> I'm a bit confused by the stuff on the wiki about the
> word being removed.
> 
> Would it be correct to say that this snippet:
> <${1}>$GEDIT_SELECTED_TEXT</${1}>
> 
> could be replaced with this:
> 
> <${1}>$GEDIT_CURRENT_WORD</${1}>
> 
> and the effect would be that I wouldn't need to
> double-click to select the word first -- I could just
> click in the word I want to enclose in tags?

That is exactly what it does. It finds the word boundaries of the word
the cursor is currently in and replaces that word with the snippet
contents (replacing the GEDIT_CURRENT_WORD var with the current word).

Note that this behavior (removing the current word and inserting the
snippet there) will only happen when GEDIT_CURRENT_WORD is used in a
snippet which makes that variable somewhat special.

-- 
Jesse van den Kieboom

Visit: http://www.icecrew.nl




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]