Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Delphi 2010 - Source files randomly become read-only in editor?

Does anyone else have this problem or is my Delphi cursed somehow?

I'll have a bunch of forms and files open in tabs in the editor and I'll be typing away and then suddenly everything stops - my .pas file has, seemingly at random, become read-only.

Sometimes I can just right-click the tab at the top and uncheck "Read-Only" and continue, but sometimes this option is checked and greyed-out (disabled), meaning I can't uncheck it and I can't make any further edits to the file. This too seems to be random.

In the latter case, the only solution is to save the file in question, which works, despite Delphi's assertion that the file is read-only, close its tab in the editor, and re-open it. Not catastrophic, really, but it's starting to become annoying.

Could it be that I am hitting a keyboard command combination accidentally to do this or is this a bug in Delphi?

I'm in Delphi 2010, Windows 7. Doubt it's anything to do with installed packages, but if anyone wants the list I'll generate it and attach it here.

like image 209
J... Avatar asked May 05 '10 14:05

J...


3 Answers

Skip to last paragraph for quick Solution :)

Yes! this just happened to me. I was typing a line of code... a line in Intraweb's ServerController.... OnBeforeDisbatch.. anyways. I was typing..

If

and then I typed a Space... so If <---- then space... and then the IDE autofilled in

If True then

after the above line was in the system all hell broke loose.... hell being that the file would stay in a read-only mode....

I edited the file manually and removed the line

if True then

and all is good.

just to update: I do believe it is file size... 125K and then bang. at least on the server controller... IW10/Delphi 2010

update again... 8 hours later...

I reduced my source file (iwservercontroller) from 125k to well under 80k and all was good. then now right when I first press the control key to paste over a value the file goes read-only!! like wow....

going to reduce file again..

Minutes later...

after shutting down d2010 and reloading project... I have narrowed down the problem to using the "paste" command.... the second I tried to paste a clipboard value read-only occurred... but a harddrive hit occurred for a instant before the read-only activated!

Final solution!!! I got it! I couldn't believe there is a "Read Only" option in the Right Click Menu.... Click on the left side Pane where the check box is when the Read-Only appears! no more need to restart IDE and reload everything etc etc...

All fixed... whoo hoo

Nope... not all fixed... 3 hours later... I reactivate IDE and I am just about to paste in some data and then the file goes in read only (not explorer's file attributes) and the Pop up menu value is now grayed out!! like wtf!!

Full day later.. trying everything.. I have a solution!! first time I got it to go off read-only without using the PUM/insert Key

simply just access the unit in question that is causing read-only and do a single character change with a outside app. (ultraedit) and save. upon saving d2010 will detect outside changes and go switch back to insert-mode even with the pop up menu is disabled.... whoo hoo...

* Final Solution * Things are all good now and not a single read-only but the solution is not too elegant in terms of keeping my text edit habits in check.. but if you open settings and change the editor to keep insert mode on you will be laughing to the bank... at least things are all good for me now.

Delphi2010-->Options-->Editor Options-->["Insert Mode"] check that option.

Seems since i have had the above checkbox clicked not a single Read-only.... good luck.

like image 55
Lenn Dolling Avatar answered Sep 24 '22 08:09

Lenn Dolling


This happened once to me. I think it's a bug, I can't find an existing report for it and when you find repeatable steps the please create QC report for it.

like image 1
Uwe Schuster Avatar answered Sep 23 '22 08:09

Uwe Schuster


This happens to us all the time - once a file gets over a certain size/complexity Delphi starts randomly going read only - sometimes accompanied by freezing for several seconds.

We think it's something to do with the syntax highlighter failing on certain constructs - certainly it comes and goes in waves, and I've had times where I've been reduced to editing a file in notepad just to get some work done.

It happens on units with no related DFM, so it's not a component doing it, and it's not storage related (Delphi isn't writing to the disk when it fails).

like image 1
Tony Avatar answered Sep 22 '22 08:09

Tony