Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: stuffbit on May 22, 2006, 10:37:17 am

Title: syntax-highlighting on write-protected sourcefiles fail
Post by: stuffbit on May 22, 2006, 10:37:17 am
Hi all,
i have a problem with syntax-highlighting, when opening a write-protected file in the editor. The highlighting then is completely wrong. If the file is not write-protected, everything is fine. When a write-protected file is in the editor (with incorrect syntax-coloring) it is sufficient to open the syntax-highlighting dialog and to terminate it with OK. Then this single write-protected file is shown with the correct highlighting until code::blocks is ended. With the next start of c::b, the problem is the same as before.
- DZi

I´m using c::b rev. 2438, Win XP SP2
Title: Re: syntax-highlighting on write-protected sourcefiles fail
Post by: Michael on May 22, 2006, 07:50:25 pm
I´m using c::b rev. 2438, Win XP SP2

Hello,

Try with a more recent C::B revision if you still have your problem.

Best wishes,
Michael
Title: Re: syntax-highlighting on write-protected sourcefiles fail
Post by: sethjackson on May 22, 2006, 11:09:02 pm
Hi all,
i have a problem with syntax-highlighting, when opening a write-protected file in the editor. The highlighting then is completely wrong. If the file is not write-protected, everything is fine. When a write-protected file is in the editor (with incorrect syntax-coloring) it is sufficient to open the syntax-highlighting dialog and to terminate it with OK. Then this single write-protected file is shown with the correct highlighting until code::blocks is ended. With the next start of c::b, the problem is the same as before.
- DZi

I´m using c::b rev. 2438, Win XP SP2

It is known although maybe somewhat forgotten (http://forums.codeblocks.org/index.php?topic=2644.0)

Anyways could you please post this to the BerliOS bug tracker (http://developer.berlios.de/bugs/?group_id=5358) (so it won't be lost). I may be able to fix it. :D
Title: Re: syntax-highlighting on write-protected sourcefiles fail
Post by: stuffbit on May 23, 2006, 11:13:38 am
Hi,
with Rev.2484 the problem with syntax-highlighting is still there.
I´ll try to post the problem to the bug-tracker.
- DZi
Title: Re: syntax-highlighting on write-protected sourcefiles fail
Post by: thomas on May 23, 2006, 01:13:53 pm
Quote
when opening a write-protected file in the editor. The highlighting then is completely wrong. If the file is not write-protected, everything is fine.
This is no bug, it is intentional behaviour.

Quote
it is sufficient to open the syntax-highlighting dialog and to terminate it with OK. Then this single write-protected file is shown with the correct highlighting until code::blocks is ended.
This is a bug.
Title: Re: syntax-highlighting on write-protected sourcefiles fail
Post by: sethjackson on May 23, 2006, 08:01:43 pm
Quote
when opening a write-protected file in the editor. The highlighting then is completely wrong. If the file is not write-protected, everything is fine.
This is no bug, it is intentional behaviour.

Quote
it is sufficient to open the syntax-highlighting dialog and to terminate it with OK. Then this single write-protected file is shown with the correct highlighting until code::blocks is ended.
This is a bug.

Exactly.

EDIT:

Proposed fix here (https://developer.berlios.de/patch/index.php?func=detailpatch&patch_id=1075&group_id=5358).
Title: Re: syntax-highlighting on write-protected sourcefiles fail
Post by: tiwag on May 24, 2006, 08:39:52 am
i don't understand the reason, why write protected files should not use the same highlighting scheme as non write protected.
why is this intentional ?


from my point of view it would be much more user-friendly, if write-protected files would use exactly the same highlighting-scheme as not write protected ones.

not everyone is using svn - in many companies version-control is done by other systems, which are using file-protecting until you have checked out a specific file to work with, but normally you have to look in many other files too, which you didn't check out for editing.
i find the current highlighting handling of write-protectde files really annoing. if you can't edit a file, you know already that it's write protected, that's enough.
Title: Re: syntax-highlighting on write-protected sourcefiles fail
Post by: mandrav on May 24, 2006, 09:37:55 am
if you can't edit a file, you know already that it's write protected, that's enough.

Well, the first few times this happened to me, I thought my keyboard was broken or a virus had entered my system :P
Title: Re: syntax-highlighting on write-protected sourcefiles fail
Post by: worster on May 24, 2006, 09:57:45 am
In my opinion, you could just place a little meaningful file icon to indicate a file is write-protected,
that's enough, and the syntax highlight should be the same as files which are not protected.

Just my point of view.
Title: Re: syntax-highlighting on write-protected sourcefiles fail
Post by: mandrav on May 24, 2006, 10:02:11 am
Well, I suggest someone should start a poll about this issue. Then we can go with what the community decides...
Title: Re: syntax-highlighting on write-protected sourcefiles fail
Post by: stuffbit on May 24, 2006, 10:47:55 am
I trapped into the problem with syntax-highlighting because we are using MKS Source Integrity as a version control system for some of our projects. File-locking is realized with the write-protection-bit. It´s unusual to check-out files from the project-archive for only viewing them in an editor. SVN has a similar function (property svn:needs-lock) if you don´t want to merge files when they are committed to the repository.
I used CodeWright for many years as my preferred source-editor before I started to work with code::blocks.
- DZi
Title: Re: syntax-highlighting on write-protected sourcefiles fail
Post by: thomas on May 24, 2006, 11:51:43 am
SVN has a similar function (property svn:needs-lock) if you don´t want to merge files when they are committed to the repository.
While the arguments about some other revision control systems are certainly correct, locking in SVN is only to be used for files that do not work well for merging, such as binary images. You can of course do differently, but that is wrong.
In the Subversion philosophy, locking is "considered generally harmful to collaboration".

Every file that can be edited in Code::Blocks can be merged without problems. Therefore, in the normal case, no such file should be locked. There may be exceptions to this rule, but there are few.
Title: Re: syntax-highlighting on write-protected sourcefiles fail
Post by: sethjackson on May 24, 2006, 01:43:58 pm
I think the way C::B handles the syntax highlighting of write protected files is ok, but this is my opinion.....
Title: Re: syntax-highlighting on write-protected sourcefiles fail
Post by: ProutDeMammouth on May 24, 2006, 01:53:57 pm
Well, I suggest someone should start a poll about this issue. Then we can go with what the community decides...
or just add an option somewhere.
Title: Re: syntax-highlighting on write-protected sourcefiles fail
Post by: sethjackson on May 24, 2006, 01:58:31 pm
Well, I suggest someone should start a poll about this issue. Then we can go with what the community decides...
or just add an option somewhere.

That is an even better idea. :D
Title: Re: syntax-highlighting on write-protected sourcefiles fail
Post by: takeshimiya on May 24, 2006, 02:06:26 pm
Well, I suggest someone should start a poll about this issue. Then we can go with what the community decides...
or just add an option somewhere.

That is an even better idea. :D

No I don't think so. It's better to find a better default (decided by the community as Yiannis said) rather than start cluttering with options.

I vote for a wxBeep (sound) when the user tries to write,
maybe even a MessageBox "This file is read only.",
and a "Read only" in the status bar in red/brown colour.
Title: Re: syntax-highlighting on write-protected sourcefiles fail
Post by: ProutDeMammouth on May 24, 2006, 02:08:31 pm
I just checked the "Syntax highlighting" dialog box. Currently, we have the choice for the "Background" only. A new button for "Write-protected Backgrnd" below would be the solution.
Title: Re: syntax-highlighting on write-protected sourcefiles fail
Post by: takeshimiya on May 24, 2006, 02:15:40 pm
I just checked the "Syntax highlighting" dialog box. Currently, we have the choice for the "Background" only. A new button for "Write-protected Backgrnd" below would be the solution.

That doesn't solves the problem, because the users that are using those version control systems would be setting to "white" that background, thus solving the "annoying to read" part, but with a new problem: it will not be clear if it's read-only.
Title: Re: syntax-highlighting on write-protected sourcefiles fail
Post by: mandrav on May 24, 2006, 02:19:25 pm
Well, I suggest someone should start a poll about this issue. Then we can go with what the community decides...
or just add an option somewhere.

This will not be made an option. We can't possibly add options for every little thing that could possibly be configured. All we would achieve is create a maze of options.

I have resolved this issue by removing the gray bg color completely (for read-only files) and fixing the state updates (i.e. file's icon in the project tree).
I hope everyone is happy now.
Title: Re: syntax-highlighting on write-protected sourcefiles fail
Post by: tiwag on May 24, 2006, 02:33:24 pm
I have resolved this issue by removing the gray bg color completely (for read-only files) and fixing the state updates (i.e. file's icon in the project tree).
I hope everyone is happy now.
CB is now much better usable with version-control-systems which are using the read-only bit for file-protection !

thanks a lot, i'm very  :D  :D  :D now !


btw.: i hope we don't get a bug-report about the missing ugly grey background when a file is set read-only  :P