Wrap selected code

Post your questions and problem reports here

Moderator: kfury77

Forum rules
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;
Post Reply
G-Sun
Posts: 70
Joined: Mon Feb 11, 2013 12:40 pm

Wrap selected code

Post by G-Sun »

Hi!

Is there a way to wrap selected code, inserting a new tag?
www.g-sun.no/en/
User avatar
Aivars
Blumentals Software Developer
Posts: 2462
Joined: Thu Aug 22, 2002 1:40 pm
Location: Latvia

Re: Wrap selected code

Post by Aivars »

Could you please elaborate and/or give an example?
Blumentals Software Programmer
G-Sun
Posts: 70
Joined: Mon Feb 11, 2013 12:40 pm

Re: Wrap selected code

Post by G-Sun »

Ok

Code: Select all

<li>some text</li>
to

Code: Select all

<ul><li>some text</li></ul>
www.g-sun.no/en/
User avatar
Aivars
Blumentals Software Developer
Posts: 2462
Joined: Thu Aug 22, 2002 1:40 pm
Location: Latvia

Re: Wrap selected code

Post by Aivars »

You mean, select "some text" and then press a button to wrap it in tags (e.g. wrap in <li> or wrap in <ul>)? Wouldn't that mean you would need awfully lot of buttons since there are many tags? Or do you want to be able to select text, enter tag name and press OK to wrap it?
Blumentals Software Programmer
G-Sun
Posts: 70
Joined: Mon Feb 11, 2013 12:40 pm

Re: Wrap selected code

Post by G-Sun »

Aivars wrote:You mean, select "some text" and then press a button to wrap it in tags (e.g. wrap in <li> or wrap in <ul>)? Wouldn't that mean you would need awfully lot of buttons since there are many tags?
No
Or do you want to be able to select text, enter tag name and press OK to wrap it?
Yes

And delete tag, not content.
Edit: I see delete tag is there, but it's only working for the selected part of the tag, not start-end.
(I guess that's an FR.. :) )
www.g-sun.no/en/
User avatar
Aivars
Blumentals Software Developer
Posts: 2462
Joined: Thu Aug 22, 2002 1:40 pm
Location: Latvia

Re: Wrap selected code

Post by Aivars »

I made a plugin for you: http://forums.blumentals.net/viewtopic.php?f=33&t=6241

Install it using Plugin Manager (menu Plugins -> Manage Plugins). You can also assign shortcut key from the Plugin Manager if you wish.
Blumentals Software Programmer
G-Sun
Posts: 70
Joined: Mon Feb 11, 2013 12:40 pm

Re: Wrap selected code

Post by G-Sun »

Aivars wrote:I made a plugin for you: http://forums.blumentals.net/viewtopic.php?f=33&t=6241

Install it using Plugin Manager (menu Plugins -> Manage Plugins). You can also assign shortcut key from the Plugin Manager if you wish.
Now, that is neat. Thank you!
Working very well :D

Tried putting it in the context menu, but didn't manage. Maybe something I didn't understand.

May I ask: Why as pluin, and not native?

Anyway, thanks a lot!
www.g-sun.no/en/
User avatar
Aivars
Blumentals Software Developer
Posts: 2462
Joined: Thu Aug 22, 2002 1:40 pm
Location: Latvia

Re: Wrap selected code

Post by Aivars »

Plugins are easier to add and don't need to be approved by change control.

You can customize context menu by selecting Customize Context Menu from the context menu.
Blumentals Software Programmer
G-Sun
Posts: 70
Joined: Mon Feb 11, 2013 12:40 pm

Re: Wrap selected code

Post by G-Sun »

Aivars wrote:Plugins are easier to add and don't need to be approved by change control.
Ok :)
You can customize context menu by selecting Customize Context Menu from the context menu.
I've tried. A customize-window shows up, but it has only "close" as option, not "select" or "add" or something.. ??
www.g-sun.no/en/
User avatar
Aivars
Blumentals Software Developer
Posts: 2462
Joined: Thu Aug 22, 2002 1:40 pm
Location: Latvia

Re: Wrap selected code

Post by Aivars »

Simply drag the command (in this case Wrap with tag command) to the menu, after selecting Customize Context Menu.
Blumentals Software Programmer
G-Sun
Posts: 70
Joined: Mon Feb 11, 2013 12:40 pm

Re: Wrap selected code

Post by G-Sun »

Aivars wrote:Simply drag the command (in this case Wrap with tag command) to the menu, after selecting Customize Context Menu.
Ah. Thanks!
www.g-sun.no/en/
Post Reply