GNOME Bugzilla – Bug 167304
Replace cannot turn some strings into expressions
Last modified: 2006-04-05 19:55:24 UTC
Version details: 1.4.2-2 Debian/Sarge If an expression contains a leading SINGLE QUOTE character, this cannot be found or replaced with option "Search text is" "Plain text". E.g. the expression '=Sheet3!A1 cannot be replaced to =Sheet3!A1
The single quote isn't part of the cell content: if you asked for the left-most character it would be "=", not the quote. The single quote serves only as a marker to prevent strings from being interpreted. And therein lies the trouble: in general we want to keep strings as string and not have them interpreted. Suppose we have two cells: A1: =sum(1,2,3) [an expression] A2: '=sum(1,2,3) [a string] and replace 3 by 4. I don't think we want A2 to become an expression. If we have A3: BLUE and replace "BL" by "TR", then currently we change A3 to a boolean-valued cell. That doesn't feel right.
Any user explicitely replacing the leading single quote knows what he is doing. But nobody will understand, why he can see, add, remove the leading quote in the edit line, i.e. it is part of the cell content from the users point of view, but it is not possible to find/replace it.
Don't get me wrong: we need to improve something, but it isn't clear exactly what. The problem with the single quote is that it is not part of the cell contents. Type 'xxx and Gnumeric will eat the quote. For strings that would be interpreted differently without a quote, we tag a single quote back on when displaying in the edit line. Ok, you say, for search and replace simply pretend the single quote is real. That breaks other things, such as searching for all cells starting with a minus. I cannot think of a reason we would want to break that. We need to find a solution that works for as many reasonable things as we can.
Fixed in cvs. The dialog's "Advanced" tab now has an extra check button "Keep strings as strings". It is checked by default. You still cannot search and replace the single quote, but you get the same effect by replacing "=" by "=" (or the empty string by the empty string). In the BLUE->TRUE case above, TRUE will now be a string unless you uncheck the new button.