Hi Jussi,
I found a bug in highlighting a match brace for C++. Below is an example. Put the cursor on the open brace after the last "else" as indicated by the comment. The wrong matching brace is highlighted. Remove the C style comment after "if(check4)", and the correct matching brace is highlighted. I have a lot of old plain C code I am supporting that is commented this way.
void func( void )
{
if (check1 )
{ /* RUNNING SLOW OR MAKEREADY, LEAVE GOOD/BAD SWITCH OFF */
if (check2)
{
dummy = 1;
}
}
else if ( check3 )
{
dummy = 2;
}
else
{ // <====put cursor on this brace and wrong mating brace is highlighted
if ( check 4 )
{ /* ***** THIS COMMENT CAUSES ERROR ****** */
if ( check 4)
{
dummy = 4;
}
}
}
}
highlighting a matching brace doesn't work with C comments
Re: highlighting a matching brace doesn't work with C comments
Starting with your code from the forum post, I used the Macros, Tools, Re-indent and Restyle menu option to produce this formatted version of that code:
As you can see when I place the cursor on the brace in question, I get the following brace matching result:
I'm guessing you're not seeing that same result as for me the brace matching looks correct.
I guessing this error relates to one of your options that got erroneously applied when you copied over your old zConfig options.
To find the option that is wrong I would do the following:
1. Install the latest version in a new directory. Zeus can run any number of versions side by side, the just have to be in their own directory.
2. From the command line run the old and the new versions by using the -s option (run a second instance option)
3. Confirm there is a difference in the brace matching in both of these versions.
4. Visually compare the settings found in the C/C++ Document Types to find the difference.
Cheers Jussi
Code: Select all
void func( void )
{
if (check1 )
{
/* RUNNING SLOW OR MAKEREADY, LEAVE GOOD/BAD SWITCH OFF */
if (check2)
{
dummy = 1;
}
}
else if ( check3 )
{
dummy = 2;
}
else
{ // <====put cursor on this brace and wrong mating brace is highlighted
if ( check 4 )
{
/* ***** THIS COMMENT CAUSES ERROR ****** */
if ( check 4)
{
dummy = 4;
}
}
}
}
I guessing this error relates to one of your options that got erroneously applied when you copied over your old zConfig options.
To find the option that is wrong I would do the following:
1. Install the latest version in a new directory. Zeus can run any number of versions side by side, the just have to be in their own directory.
2. From the command line run the old and the new versions by using the -s option (run a second instance option)
3. Confirm there is a difference in the brace matching in both of these versions.
4. Visually compare the settings found in the C/C++ Document Types to find the difference.
Cheers Jussi
Re: highlighting a matching brace doesn't work with C comments
Interesting, when I copy what I pasted into the forum back into the Zeus, everything works find. The tried running the Re-Indent macro on one of the old C file I have. Before running Re-Indent, brace matching didn't work. After running it, brace matching does work. However, it is easy to recreate the problem. Here's the same code that doesn't work, except I replaced all tabs with spaces. If I move the comment THIS COMMENT CAUSES ERROR to its own line ( which is what Re-Indent does), then the problem comes back.
That said, I am fine with you ignoring this. The re-indent macro is an easy solution. Even better, maybe I will make a macro to convert the C style comment (/* */)to C++ ( // ).
Thanks!
Jack
void func( void )
{
if (check1 )
{/* RUNNING SLOW OR MAKEREADY, LEAVE GOOD/BAD SWITCH OFF */
if (check2)
{
dummy = 1;
}
}
else if ( check3 )
{
dummy = 2;
}
else
{ /* <====put cursor on this brace and wrong mating brace is highlighted */
if ( check 4 )
{ /* ***** THIS COMMENT CAUSES ERROR ****** */
if ( check 4)
{
dummy = 4;
}
}
}
}
That said, I am fine with you ignoring this. The re-indent macro is an easy solution. Even better, maybe I will make a macro to convert the C style comment (/* */)to C++ ( // ).
Thanks!
Jack
void func( void )
{
if (check1 )
{/* RUNNING SLOW OR MAKEREADY, LEAVE GOOD/BAD SWITCH OFF */
if (check2)
{
dummy = 1;
}
}
else if ( check3 )
{
dummy = 2;
}
else
{ /* <====put cursor on this brace and wrong mating brace is highlighted */
if ( check 4 )
{ /* ***** THIS COMMENT CAUSES ERROR ****** */
if ( check 4)
{
dummy = 4;
}
}
}
}
Re: highlighting a matching brace doesn't work with C comments
Unfortunately I can't replicate the error 
Even if I this unformatted version of the code it seems to work fine for me:
As I move the cursor down vertically from line 1, column 1 all the way down to line 26 column 1, all the braces are correctly matched.
Cheers Jussi

Even if I this unformatted version of the code it seems to work fine for me:
Code: Select all
void func( void )
{
if (check1 )
{/* RUNNING SLOW OR MAKEREADY, LEAVE GOOD/BAD SWITCH OFF */
if (check2)
{
dummy = 1;
}
}
else if ( check3 )
{
dummy = 2;
}
else
{ /* <====put cursor on this brace and wrong mating brace is highlighted */
if ( check 4 )
{ /* ***** THIS COMMENT CAUSES ERROR ****** */
if ( check 4)
{
dummy = 4;
}
}
}
}
Cheers Jussi