Code::Blocks Forums

User forums => General (but related to Code::Blocks) => Topic started by: headkase on December 31, 2015, 06:28:47 am

Title: Beginning with SVN 10634 code highlighting defaults to plain text
Post by: headkase on December 31, 2015, 06:28:47 am
Edit: Edited title with exact SVN.

See: Here (http://forums.codeblocks.org/index.php/topic,20813.0.html).

It seems that with SVN 10637 the default highlight mode for source code is defaulting to plain text files.  Even after changing the mode and saving all.  I did delete the APPDATA Code::Blocks settings and started fresh to make sure it wasn't in there.

Title: Re: SVN 10637 Default Code Highlighting is Plain Text
Post by: oBFusCATed on December 31, 2015, 10:09:43 am
What? Try to explain what the problem is better, please, at the moment it is hard to understand.

And please post in a single topic.
Title: Re: SVN 10637 Default Code Highlighting is Plain Text
Post by: headkase on December 31, 2015, 07:06:46 pm
What? Try to explain what the problem is better, please, at the moment it is hard to understand.

And please post in a single topic.

Sorry, created this thread as I found the issue during troubleshooting a plugin but it is about the editor so I created a new thread.

* With SVN 10637, create a new C++ console project.
* The syntax highlighting is supposed to be C++, instead it defaults to plain text.
* Highlighting is chosen from the: Edit menu, Highlight Mode. 
* Set C++ highlighting, save all, close C::B, restart, load project.
* highlighting back to plain text.

Compiler used is MinGW-Builds 5.3.0 32-bit.
Title: Re: Beginning with SVN 10634 code highlighting defaults to plain text
Post by: headkase on January 01, 2016, 11:40:51 am
Did some test compiles and narrowed down the issue:

* SVN 10633 correctly applies the appropriate code highlighting on opened files

* SVN 10634 defaults to plain text highlighting which is incorrect

Thanks,

Bill.
Title: Re: Beginning with SVN 10634 code highlighting defaults to plain text
Post by: oBFusCATed on January 01, 2016, 02:37:04 pm
Works fine for me on linux.
Can someone else confirm that the issue happens?
Title: Re: Beginning with SVN 10634 code highlighting defaults to plain text
Post by: headkase on January 01, 2016, 03:19:21 pm
Works fine for me on linux.
Can someone else confirm that the issue happens?

As always I will gladly apply and compile test patches.  It's the least I can do for all the effort that is provided from the team at no monetary cost.
Title: Re: Beginning with SVN 10634 code highlighting defaults to plain text
Post by: headkase on January 01, 2016, 03:32:13 pm
Here, this file may be useful:

https://www.dropbox.com/s/2ie4mkgwjzcfale/Highlight_Builds.7z?dl=0

It is both builds 10633 and 10634 as compiled on my own system using MinGW-Builds 5.3.0 32-bit.  No contrib plugins, just the main project.  Everything needed to run them (toolchain dll's) are included.  If another Windows user does not have the issue with a different toolchain then it might be what I'm using.
Title: Re: Beginning with SVN 10634 code highlighting defaults to plain text
Post by: MortenMacFly on January 01, 2016, 04:40:32 pm
* SVN 10633 correctly applies the appropriate code highlighting on opened files
* SVN 10634 defaults to plain text highlighting which is incorrect
I can reproduce on Windows. Lets have a look...
Title: Re: Beginning with SVN 10634 code highlighting defaults to plain text
Post by: MortenMacFly on January 01, 2016, 04:45:13 pm
* SVN 10633 correctly applies the appropriate code highlighting on opened files
* SVN 10634 defaults to plain text highlighting which is incorrect
I can reproduce on Windows. Lets have a look...
@oBFusCATed: I think for now I would revert your commit becasue it really causes the issue and that is serious. Will you do it?

Edit: Oh, and btw: After your commit I have two times the plain text file option: Ones is called "plain text" and the other is "Plain Text Files". Why? Are you sure you didn't implement something that was already there? :-)
Title: Re: Beginning with SVN 10634 code highlighting defaults to plain text
Post by: MortenMacFly on January 01, 2016, 04:54:36 pm
Did some test compiles and narrowed down the issue:
For now, please remove the lexer on Windows (lexer_plain.xml) then it should work again. I think the reason for the bug is simple: The file mask in the lexer (*) hits for all files. As the index (1) is the lowest index it will always "win" for all files. Thus, all files will be handled as "plain text". This surely it not what we want, isn't it? To me its weird that it works on Linux, because it should show the same effect. Or does "*" mean really just a file w/o extension?
Title: Re: Beginning with SVN 10634 code highlighting defaults to plain text
Post by: headkase on January 01, 2016, 04:59:13 pm
For now, please remove the lexer on Windows (lexer_plain.xml) then it should work again.

Yes, removing that file restores correct behavior without doing any other change.  Thanks.
Title: Re: Beginning with SVN 10634 code highlighting defaults to plain text
Post by: oBFusCATed on January 01, 2016, 05:07:56 pm
To me its weird that it works on Linux, because it should show the same effect. Or does "*" mean really just a file w/o extension?
Probably on my machine or on linux the plain text lexer is loaded after the other lexers. So it is added to the end of the list of lexers.
Title: Re: Beginning with SVN 10634 code highlighting defaults to plain text
Post by: oBFusCATed on January 01, 2016, 05:17:01 pm
Edit: Oh, and btw: After your commit I have two times the plain text file option: Ones is called "plain text" and the other is "Plain Text Files". Why? Are you sure you didn't implement something that was already there? :-)
Nope I see only "Plain Text Files" in the combo box. But I see the "Plain text" menu option in the Highlight menu.
So I guess there is more work to do about this patch.
And obviously I was right that this change is not safe for 15.12 :)
Title: Re: Beginning with SVN 10634 code highlighting defaults to plain text
Post by: Scr3amer on January 03, 2016, 02:10:19 am
Hey guys,

So I had the same bug, good to know it is not from my side.

But I have another question concerning the syntax hightlight when I build from source : is it normal the members of classes are not highlighted ? Because on C::B 13.12 they are highlighted in purple (default theme color).

Thanks again for the great work you do with C::B  :D !
Title: Re: Beginning with SVN 10634 code highlighting defaults to plain text
Post by: Alpha on January 03, 2016, 04:16:08 am
But I have another question concerning the syntax hightlight when I build from source : is it normal the members of classes are not highlighted ? Because on C::B 13.12 they are highlighted in purple (default theme color).
This is controlled by Settings->Editor->Code Completion->pseudo semantic keyword highlighting.

@devs: Some of the options there are "Disable xyz", and some are "Enable xyz"... this is kind of confusing.
Title: Re: Beginning with SVN 10634 code highlighting defaults to plain text
Post by: ollydbg on January 03, 2016, 09:24:29 am
But I have another question concerning the syntax hightlight when I build from source : is it normal the members of classes are not highlighted ? Because on C::B 13.12 they are highlighted in purple (default theme color).
This is controlled by Settings->Editor->Code Completion->pseudo semantic keyword highlighting.

@devs: Some of the options there are "Disable xyz", and some are "Enable xyz"... this is kind of confusing.
I prefer the "Enable xyz" kinds option.  :)
Title: Re: Beginning with SVN 10634 code highlighting defaults to plain text
Post by: Scr3amer on January 03, 2016, 04:49:04 pm
But I have another question concerning the syntax hightlight when I build from source : is it normal the members of classes are not highlighted ? Because on C::B 13.12 they are highlighted in purple (default theme color).
This is controlled by Settings->Editor->Code Completion->pseudo semantic keyword highlighting.

@devs: Some of the options there are "Disable xyz", and some are "Enable xyz"... this is kind of confusing.

Thanks for the help :D !