Hi! I'm a complete newbie with WeBuilder (the latest version) and want to ask a basic question.
I've created several snippets, a feature that I'm coming to love, but I don't know how to get snippets to surround a selected text instead of replacing it.
For example, if I select the following sentence:
I want this sentence to be in purple color
and then run my snippet which begins with -- before the caret:
<Font COLOR="#8000ff">
and ends with -- after the caret:
</FONT>
or another example:
I want to add link code:
I select the text:
click here
and my snippet is, before the caret:
<A HREF="" Target="_blank">
and after the caret is:
</A>
Is there some code or wildcard I can use to get snippets to surround selected text instead of replacing it?
thank you very much.
using snippets with selected text
Moderator: kfury77
Forum rules
Please try to follow these guidelines. This will help to receive faster and more accurate response.
Please try to follow these guidelines. This will help to receive faster and more accurate response.
- Check the Support section of the corresponding product first. Chances are you will find your answer there;
- Do not create new topics for already reported problems. Add your comments to the existing topics instead;
- Create separate topic for each problem request. Do NOT post a number of non-related problem reports in a single topic;
- Give your topic a meaningful title. Titles such as "A question," "Bug report" and "Help!" provide others no clue what your message is about;
- Include the version number of the software you are using;
- This is not an official customer support helpdesk. If you need a prompt and official response, please contact our support team directly instead. It may take a while until you receive a reply in the forum;
Re: using snippets with selected text
Hi,
Actually it must work the way you have described.
Here is what you need to do:
1) Select the text in code editing area;
2) Double click the snippet or call it by the short-cut you have assigned to it;
3) The selected text will not be replaced, but will stay in place, only the Fields "Insert before caret" and "Insert after caret" will be placed inside the code editor before and after the selected text.
If you are doing it somehow differently, then please give us the steps you take.
Kind regards,
Gatis
Actually it must work the way you have described.
Here is what you need to do:
1) Select the text in code editing area;
2) Double click the snippet or call it by the short-cut you have assigned to it;
3) The selected text will not be replaced, but will stay in place, only the Fields "Insert before caret" and "Insert after caret" will be placed inside the code editor before and after the selected text.
If you are doing it somehow differently, then please give us the steps you take.
Kind regards,
Gatis
Kind regards,
Gatis Avots
Gatis Avots
Re: using snippets with selected text
Dear Gatis,
Thank you for responding so promptly.
Actually, the problem is a bit more than I've stated.
I've been using the Control-J hot key to show the list of Snippets, but the list doesn't appear unless I press Control-J when my cursor is on an empty space.
If I press Control-J after having selected text, the text is automatically replaced with one of my snippets (I don't see the list of snippets at all or even have a choice of which snippet it uses).
I don't want to assign a hot key to each snippet (too much to remember) -- I want to use the snippet listing -- and am unclear how else to call the snippet up effectively with selected text.
Help please!
thank you very much
Thank you for responding so promptly.
Actually, the problem is a bit more than I've stated.
I've been using the Control-J hot key to show the list of Snippets, but the list doesn't appear unless I press Control-J when my cursor is on an empty space.
If I press Control-J after having selected text, the text is automatically replaced with one of my snippets (I don't see the list of snippets at all or even have a choice of which snippet it uses).
I don't want to assign a hot key to each snippet (too much to remember) -- I want to use the snippet listing -- and am unclear how else to call the snippet up effectively with selected text.
Help please!
thank you very much
Re: using snippets with selected text
The list must appear, if you have assigned a call-word to snippets you use. If there is only one snippet with this call-word, the snippet with this call-word will be automatically inserted. Otherwise you can choose from the list.I've been using the Control-J hot key to show the list of Snippets, but the list doesn't appear unless I press Control-J when my cursor is on an empty space.
Selection will not work with the list you use when pressing Ctrl+J, because it is a different feature - called Code templates. It only tries to insert a snippet based on the word before your cursor. You can learn more about this under Main Menu; Reusing Code; Code templates.
Kind regards,
Gatis
Kind regards,
Gatis Avots
Gatis Avots