Highlight tag content (=code folding sections)?

This forum is user-to-user based and not regularly monitored by IDM.
Please see the note at the top of this page on how to contact IDM.

Highlight tag content (=code folding sections)?

Postby Elminster » Sat Sep 02, 2006 1:46 pm

Hello,
I'm wondering if it is possible to highlight the content of a tag resp. The content of a code folding section - similiar to the active line highlighting. In PSPad is an option "Select Tag" that comes close to this. Still it would be much more usefull to automatically highlight a tag on click instead of selecting it. Also nice would be an option to lock such a highlighting (for easy editing within).

I attached a screenshot for illustration.

If this is not possible I would suggest it as a feature to be added :)

Image
User avatar
Elminster
Newbie
 
Posts: 2
Joined: Fri Sep 01, 2006 11:00 pm

Re: Highlight tag content (=code folding sections)?

Postby Mofi » Wed Sep 06, 2006 7:43 am

Well, UltraEdit/UEStudio is not as optimized as PSPad for web page editing. There is already a discussion about that - see UEdit or PSPAD ???

A macro can be used for selecting the characters between 2 HTML tags as posted at Some questions about functions. But it is definitively not perfect, especially on nested elements like in your screenshot. If your HTML code is always as perfect indented as in your screenshot an improved macro code could select always the correct matching end tag for the current tag.

But I think locking a selection will never be available in UltraEdit/UEStudio.

You could only temporarily convert the current selection to an alternate comment with different background color and when finished editing in it remove the alternate comments with a macro.

Also you could use the multi-language syntax highlighting feature to highlight a selection temporarily with a different background color. For example if you never use ASP in your HTML files you could copy the whole HTML language definition in your wordfile to an other language number and replace HTML_LANG by ASP_LANG. Then you need a macro which adds before and after current selection the start and end tag for VBScript and a second macro which removes these elements next the current cursor position when "locking" should be disabled.

Both are dirty tricks, but maybe useful for you.

However, feature requests can be always send to IDM.
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 3937
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna

Re: Highlight tag content (=code folding sections)?

Postby Elminster » Wed Sep 06, 2006 4:34 pm

Thank you for your exhaustive answer :)

If your HTML code is always as perfect indented as in your screenshot


If I create a new file myself I try to stick to a good formatting. But the reason in the first place for my question was, that I sometimes have a hard time to understand other people's layout/structure in files. The file in the screenshot wasn't from me too, but the the "Reformate HTML Code"-option in PSPad was quite useful (if not completly failsafe) ;)

Anyway, it's not that important to fall back to some "dirty tricks", but I still think that it should be pretty easy to implement, since UE already does recognize start and end tags pretty well (-> code folding). It got just to be vice versa (in a way) - highlight instead of hide :)
User avatar
Elminster
Newbie
 
Posts: 2
Joined: Fri Sep 01, 2006 11:00 pm

Re: Highlight tag content (=code folding sections)?

Postby Mofi » Thu Sep 07, 2006 8:15 am

Extra hint: Use HTMLTidy with the appropriate options to reformat bad formatted HTML files.
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 3937
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna

Tag matching feature?

Postby InGearX » Tue Jul 10, 2007 8:18 pm

Is there any feature to match HTML tags?

Say when the cursor is in an opening DIV tag - UE will highlight the closing tag?

a coworker was using PSPad and I tried it and it had that feature - but I love UE too much to switch...

Maybe there are some features like that?
And an ability to collapse block of codes or tags or so...
Or to auto fix the indentation in code (Java or HTML or ...)

Please advise...

Thank you all...
User avatar
InGearX
Newbie
 
Posts: 1
Joined: Thu Aug 26, 2004 11:00 pm

Re: Tag matching feature?

Postby Mofi » Wed Jul 11, 2007 7:03 am

Yes and no. You can use the code folding feature. Fold the current block (div, p, table, ...), select the folded block and unfold it and you will see whole block selected.

The macros at Finding matching tag could be also helpful for you and there I have also explained how to modify the match brace feature of the syntax highlighting engine. I have never tested if this suggestion really works. The post was for XML, but HTML is very similar.

Collapsing block of codes can be done with the code folding feature.

Reindenting can be done with the Format - ReIndent Selection if the indent and unindent strings are good customized by you in the syntax highlighting wordfile for HTML, JavaScript, etc.
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 3937
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna


Return to UEStudio General Discussion