Author Topic: syntax-highlighting on write-protected sourcefiles fail  (Read 10813 times)

Offline stuffbit

  • Single posting newcomer
  • *
  • Posts: 3
syntax-highlighting on write-protected sourcefiles fail
« 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

Im using c::b rev. 2438, Win XP SP2

Offline Michael

  • Lives here!
  • ****
  • Posts: 1608
Re: syntax-highlighting on write-protected sourcefiles fail
« Reply #1 on: May 22, 2006, 07:50:25 pm »
Im 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

sethjackson

  • Guest
Re: syntax-highlighting on write-protected sourcefiles fail
« Reply #2 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

Im using c::b rev. 2438, Win XP SP2

It is known although maybe somewhat forgotten

Anyways could you please post this to the BerliOS bug tracker (so it won't be lost). I may be able to fix it. :D

Offline stuffbit

  • Single posting newcomer
  • *
  • Posts: 3
Re: syntax-highlighting on write-protected sourcefiles fail
« Reply #3 on: May 23, 2006, 11:13:38 am »
Hi,
with Rev.2484 the problem with syntax-highlighting is still there.
Ill try to post the problem to the bug-tracker.
- DZi

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: syntax-highlighting on write-protected sourcefiles fail
« Reply #4 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.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

sethjackson

  • Guest
Re: syntax-highlighting on write-protected sourcefiles fail
« Reply #5 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.
« Last Edit: May 23, 2006, 09:09:33 pm by sethjackson »

Offline tiwag

  • Developer
  • Lives here!
  • *****
  • Posts: 1196
  • sailing away ...
    • tiwag.cb
Re: syntax-highlighting on write-protected sourcefiles fail
« Reply #6 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.
« Last Edit: May 24, 2006, 09:02:06 am by tiwag »

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4291
    • Code::Blocks IDE
Re: syntax-highlighting on write-protected sourcefiles fail
« Reply #7 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
Be patient!
This bug will be fixed soon...

Offline worster

  • Multiple posting newcomer
  • *
  • Posts: 12
Re: syntax-highlighting on write-protected sourcefiles fail
« Reply #8 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.

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4291
    • Code::Blocks IDE
Re: syntax-highlighting on write-protected sourcefiles fail
« Reply #9 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...
Be patient!
This bug will be fixed soon...

Offline stuffbit

  • Single posting newcomer
  • *
  • Posts: 3
Re: syntax-highlighting on write-protected sourcefiles fail
« Reply #10 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. Its 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 dont 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

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: syntax-highlighting on write-protected sourcefiles fail
« Reply #11 on: May 24, 2006, 11:51:43 am »
SVN has a similar function (property svn:needs-lock) if you dont 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.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

sethjackson

  • Guest
Re: syntax-highlighting on write-protected sourcefiles fail
« Reply #12 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.....
« Last Edit: May 24, 2006, 01:59:19 pm by sethjackson »

Offline ProutDeMammouth

  • Multiple posting newcomer
  • *
  • Posts: 26
  • Personal Text:
Re: syntax-highlighting on write-protected sourcefiles fail
« Reply #13 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.

sethjackson

  • Guest
Re: syntax-highlighting on write-protected sourcefiles fail
« Reply #14 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

Offline takeshi miya

  • Lives here!
  • ****
  • Posts: 1487
Re: syntax-highlighting on write-protected sourcefiles fail
« Reply #15 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.

Offline ProutDeMammouth

  • Multiple posting newcomer
  • *
  • Posts: 26
  • Personal Text:
Re: syntax-highlighting on write-protected sourcefiles fail
« Reply #16 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.

Offline takeshi miya

  • Lives here!
  • ****
  • Posts: 1487
Re: syntax-highlighting on write-protected sourcefiles fail
« Reply #17 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.

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4291
    • Code::Blocks IDE
Re: syntax-highlighting on write-protected sourcefiles fail
« Reply #18 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.
Be patient!
This bug will be fixed soon...

Offline tiwag

  • Developer
  • Lives here!
  • *****
  • Posts: 1196
  • sailing away ...
    • tiwag.cb
Re: syntax-highlighting on write-protected sourcefiles fail
« Reply #19 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