Matching IF - ENDIF with lines

Display customization and font issues

Matching IF - ENDIF with lines

Postby jer99 » Wed Aug 06, 2008 9:14 am

There's an official word for lines that are in the left margin of code that match an IF with the appropriate ENDIF.
Whatever that is, is there a way to do this with UltraEdit?
User avatar
jer99
Newbie
 
Posts: 4
Joined: Thu Feb 16, 2006 12:00 am

Re: Matching IF - ENDIF with lines

Postby Mofi » Wed Aug 06, 2008 10:49 am

Are you talking about preprocessor directives or statements/keywords? In some languages IF - ENDIF are statements/keywords, in other languages these are preprocessor directives.

However, you can use Search - Match Brace to find the matching statement/keyword/directive. You just have to add these 2 words to the list of open and close brace strings in your syntax highlighting wordfile for the language used to highlight your source files.

Open Advanced - Configuration - Editor Display - Syntax Highlighting and press the button Open right to the file name of the syntax highlighting wordfile you currently use, if you don't have open a project with a project specific wordfile. Close the configuration dialog with button Cancel.

Find the line which starts with /Lx"..." with x is a number in the range of 1 ... 20 and "..." is the name of the language you see in the status bar at bottom of the UltraEdit window or in menu View - View As (Highlighting File Type) when one of your source file is the active file.

Between this language definition line and the line starting with /C1 you should see something like following:

/Open Brace Strings = "{" "(" "["
/Close Brace Strings = "}" ")" "]"


If you can't see these lines, insert them above the line starting with /C1. Next modify it to:

/Open Brace Strings = "{" "(" "[" "IF"
/Close Brace Strings = "}" ")" "]" "ENDIF"

Save the wordfile and you can immediately test, if command match brace now works for IF - ENDIF too.

Additionally I suggest to specify IF and ENDIF also as code folding keywords.

/Open Fold Strings = "IF"
/Close Fold Strings = "ENDIF"


or maybe even better

/Open Fold Strings = "IF" "ELSE"
/Close Fold Strings = "ELSE" "ENDIF"


Now you can easily fold (make hidden) all lines between matching IF - ELSE, ELSE - ENDIF and IF - ENDIF statements/keywords/directives.

For more details see in help of UltraEdit the page about syntax highlighting and the readme topic in the syntax highlighting forum.
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 4042
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna

Re: Matching IF - ENDIF with lines

Postby pietzcker » Wed Aug 06, 2008 11:52 am

Perhaps what he means is to have fold regions marked by a line in the left margin, like this:

002_Ausschnitt.png
002_Ausschnitt.png (12.19 KiB) Viewed 3774 times

I don't think that's possible with UE.
User avatar
pietzcker
Master
Master
 
Posts: 241
Joined: Sun Aug 22, 2004 11:00 pm

Re: Matching IF - ENDIF with lines

Postby jer99 » Wed Aug 06, 2008 12:47 pm

pietzcker -
That's exactly what I am looking for. It would be GREAT if UE would have this option with the ability to print.
For very lengthy programs it would be a life-saver.

Considering that UE can help identify matches already, the addition of a line to the left that is printable seems doable...

I'm really surprised that no one has done this yet.
User avatar
jer99
Newbie
 
Posts: 4
Joined: Thu Feb 16, 2006 12:00 am

Re: Matching IF - ENDIF with lines

Postby tigerlight » Thu Sep 04, 2008 11:40 am

I'm also looking for a way to highlight syntax matches for HTML tags. Folding is useful in some cases but most of the time I just want to see highlighted text

In wordfile.txt, In the section that starts with,

/L3"HTML" HTML_LANG

I added,

/Open Brace Strings = "{" "(" "[" "<div"
/Close Brace Strings = "}" ")" "]" "</div"

Auto syntax highlighting is turned on.
tigerlight
Newbie
 
Posts: 1
Joined: Thu Sep 04, 2008 11:30 am

Re: Matching IF - ENDIF with lines

Postby jer99 » Tue Jul 21, 2009 11:24 am

New version 15.10 -
Cool stuff, but disappointment when it comes to IF/THEN (logic) "staples". (see pietzcker above)
I can collapse code, yes. But I can not visually see nested loop lines - I have notches, but they do not indicate which IF matches an ENDIF.
Not only that, but it still doesn't print!!
Please, please consider giving us a more robust logic staples that actually match & print....
User avatar
jer99
Newbie
 
Posts: 4
Joined: Thu Feb 16, 2006 12:00 am

Re: Matching IF - ENDIF with lines

Postby BengalTigger » Fri Jul 24, 2009 6:41 pm

It would be really great if folded code could have the option of having the entire line highlighted so that it is not so easy to delete the folded code.
User avatar
BengalTigger
Newbie
 
Posts: 7
Joined: Tue Dec 04, 2007 12:00 am


Return to Editor Display