Community
Participate
Working Groups
for example use file->convert line endings and then save the file Actual Result: the file is marked as changed (asterisk on the tab), but i can't save it without making some other change to the file, (Adding a space or something)
Created attachment 179496 [details] patch
I couldn't understand the flow of the isDirty() method, can you take a look t this fix: @Override public boolean isDirty() { // if super.isDirty() return false,it means this if (!super.isDirty()) { return false; } if (getDocument() instanceof IStructuredDocument) { CommandStack commandStack = ((IStructuredDocument) getDocument()) .getUndoManager().getCommandStack(); if (commandStack instanceof BasicCommandStack) { BasicCommandStack bcs = (BasicCommandStack) commandStack; return bcs.isSaveNeeded(); } } return true; }
Hi Roy I retest my patch and found there is problem with it,and I thought something wrong before! You code is fine to me:)
Using version 2.2.1.v20100822-1200, this appears to be a regression in Helios SR1. When you save a PHP file for which a "save action" takes place, the file is still marked unsaved or dirty but you are not able to save it until you make a change that doesn't require the save action. Steps to reproduce: 1) Go to preferences, PHP -> Editor -> Save Actions. Make sure "Remove trailing whitespace" is checked and that "all lines" is selected. 2) Edit a PHP file. 3) Make a change to the PHP file that will require the save action to be performed (e.g. add whitespace to the end of a line or create a new line that has only whitespace characters...or convert line endings like zhaozhongwei, which probably introduced such a change). 4) Save the file using any method you prefer. 5) Note that the file does get saved (after the save action performed), however the editor believes that the file is still dirty. I would imagine also that bug 326120 is a duplicate.
(In reply to comment #4) > Using version 2.2.1.v20100822-1200, this appears to be a regression in Helios > SR1. When you save a PHP file for which a "save action" takes place, the file > is still marked unsaved or dirty but you are not able to save it until you make > a change that doesn't require the save action. > > Steps to reproduce: > 1) Go to preferences, PHP -> Editor -> Save Actions. Make sure "Remove > trailing whitespace" is checked and that "all lines" is selected. > 2) Edit a PHP file. > 3) Make a change to the PHP file that will require the save action to be > performed (e.g. add whitespace to the end of a line or create a new line that > has only whitespace characters...or convert line endings like zhaozhongwei, > which probably introduced such a change). > 4) Save the file using any method you prefer. > 5) Note that the file does get saved (after the save action performed), however > the editor believes that the file is still dirty. > > I would imagine also that bug 326120 is a duplicate. have tried: add whitespace to the end of a line or create a new line that has only whitespace characters...or convert line endings.I think it has been fixed already.
As FYI I also found that if you use search to find a string that is in a PHP file, then you right click on a search result and do "replace selected..." or "replace all..." it exhibits this behavior. Also if you right click on a file and select "replace with" -> "local history..." it happens too. Can you make sure these are fixed too? Thanks.
Tested on 2.2.1.v20101001 Fixed