If I select text, Edit - Find, and tell it to find double spaces and replace with single spaces (hoping to eliminate the pesky unseen doubles from my MS) it comes back with Not Found, even if double spaces exist, and then deletes the selected text.
This looks like a bug (and I just replicated it - definitely scary…!) but as a quick workaround - try NOT selecting the text? If I just allow it to run on the whole document, it deals with double spaces without damaging file contents.
Just found the same bug on replacing " with '. Thing is, I’ve been doing this before without any problems, so why buggy now?
ps, I’ve lost work through this, sadly, I’m not sure where. So I have a back-up document without bits taken out by the bug, and a current document with recent editing but perhaps missing bits. Great…
I think perhaps you were both using the “Replace” button rather than “Replace All”? I don’t see any text removal on the latter. With Replace, yes, if you select some text and then click Replace it will replace the selection with what you type into the replace field, that is how it works. The Find button selects text, the Replace button swaps out the selection. If you change or set the selection yourself it won’t know the difference.
I will agree it’s not ideal, and there are better solutions out there, but it’s not a bug, and it’s also not unusual behaviour either. So it’s definitely something to be aware of beyond Scrivener. In general: don’t go and select text yourself when using a Find and Replace panel, it is at best risky—if you do, always click Find first to get back into the routine.
Hmm. I was using Replace and Find, but to be honest, I don’t understand the wording used, it’s rather nonsensical. However, I think you have the right of it: safer without a pre-selection. Thank you
Yes, that’s true, I forgot about that button. The combined Replace & Find button works the same as Replace does. The only thing it does different is of course to automatically jump to the next match after swapping out the selected text.
Which isn’t exactly logical, because in Other Editors it will not happen (F&R will search inside the selection and replace found elements). I can see that the scope applies to “Replace All”, but the fact that Replace All works in such a different way to Replace & Find is not intuitive.
And, in this case, can lead to loss of text
Sure, as I acknowledged there are better models out there, I would not debate that. I have seen other editors work this way as well, and I suspect it has much to do with the underlying toolkit. I know that is the case on the Mac at least, where it works this way, and in all tools that use the basic Mac development toolkit (although we did find a way to override that behaviour there, so there is always hope).
I don’t think it is so much a matter of logic as differing experiences leading to different expectations. After all, it is logical, in a cold and hard way, that if one selects some text and clicks a button called “Replace”, that it will do so without complaint. Logic is not always desirable, however.
Yeah, but by marking and picking the replacement on the keyboard, you’d get the result without using a FIND AND REPLACE dialog If I wanted to replace a text I’ve just marked… why would I run “find” for it?