[TxMt] Re: File status after a replace all

Matt Neuburg matt at tidbits.com
Fri Sep 5 14:15:09 UTC 2014


I agree with this; I'd put the problem another way, namely by describing how I use Replace All and what happens when I do.

I do a Find All across multiple documents to see what's going to happen. I decide it's okay. I do a Replace All.

Then I switch to my project and do a Save All just like I've always done.

Now I come back to the dialog and try to start another find. And it says: Do you want to save the documents you just changed? Wait, I just did that!

So there are two problems:

(1) The Find dialog doesn't have a correct notion of whether the documents have been saved; and

(2) It's none of the Find dialog's business anyway! Its job is to find and replace. That's all. The project is where we save. I'm going to switch to the project and do the save, just like I always do.

That's pretty much the same as what Eduardo is saying. m.

PS The way BBEdit solves this is: when you do a global find-and-replace across multiple documents, you get a secondary dialog _first_ asking whether you also want to save automatically. Thus the question is settled up front. I always want to save, so I wouldn't mind having to pass thru such a dialog.

On Sep 5, 2014, at 12:55 AM, Eduardo Francos <efrancos at efrancos.com> wrote:

> Hi,
> I've found a document modified status issue when using "Replace all" with either project or folder Find in... dialogs
> 
> When the Replace All button is clicked all the matches are applied to the documents containing them, but the status of the affected documents (which where not modified before issuing the command) does not change to "modified" as it could be expected.
> 
> When you close the Find in... dialog it shows a dialog box with the option to save the affected documents.
> The text in the dialog states that the changes will be lost if you don't save them, which is actually incorrect, or at least misleading, because if you select not to save the documents they still include the applied changes. Their "modified" status though doesn't reflect this.
> 
> To reproduce the bug just open two or more files that contain a common string, open a Find in... dialog and do a replace all of that string, check the documents' statuses.
> 
> Unless I'm missing something obvious I believe that the additional "save documents" dialog is a lot of work just to save the "⌥⌘S" I'd issue anyway in most cases, but not always.
> Also, given that the Find in... dialogs aren't modal, so the user can switch back to the documents and continue working, when he gets back to the Find dialog and closes it he may not always remember the context in which he executed the replace operation. When that happens my " keep the control" attitude always forces me to select not to save them ;-)
> If a builtin "save changes" option is nevertheless required then I believe that an additional "Replace All & Save" button could be more effective.
> To minimize real estate usage this button could be placed immediately to the right of the Replace All button with just "& Save" as the label. Alternatively, given that in this case the "Replace & Find" action button is apparently always disabled it could simply replace it.
> 

--
matt neuburg, phd = http://www.apeth.net/matt/
pantes anthropoi tou eidenai oregontai phusei
Programming iOS 7! http://shop.oreilly.com/product/0636920031017.do
iOS 7 Fundamentals! http://shop.oreilly.com/product/0636920032465.do
RubyFrontier! http://www.apeth.com/RubyFrontierDocs/default.html




More information about the textmate mailing list