Worst IDE bug ever: replacing failed

I’m maximum angry right now.

In my app I used the replace-function with the following parameter:
search: “).StringValue”
replace: “).StringValue.DefineEncoding(Encodings.UTF8)”

I used “ReplaceAll” for over 700 parts in my app.
After testing it, I saw, that the replacing-function failed and my entire code is broken.

After “undoing” the changes the result is getting more worse.

results are like
“La).stringvalue.DefineEncoding(Encodings.UTF8) + data.IdxF).stringvalue.DefineEncoding(Encodings)”
“if r.IdxField(1).stringvalue.DefineEncoding(Encodi).stringvalue.DefineEncoding(Encodings.UTF8)0” OR r.IdxField(1).StringValue = “1” then"
and so on

It is not possible to replace the strings with the replace-all-function. I have to replace every single location (over 700) in my code.
And: Because I trusted Xojo, I saved the file after performing the replacements, so a lot of work after last project-backup is lost.

I’m soo angry…

Yes, I made similar experiences. Never happened with RB, only lately with Xojo.

But you should be angry with yourself. A project which handles more than 700 database columns isn’t a small one. You should have started to use a version control system long time ago.

Yes, I have. I had to manually discard my changes in git (over 90 different files). With a lot of other changes.

Until now, I didn’t commited or pushed every single change.

This experience teached me to expect bugs and errors in every basic function of xojo.

:confused:

Please fill feedback case so this can be fixed.

Feedback don’t work for me, because I’m behind a proxy…

Another annoying point.

Maybe Xojo is not recalculating the replacement positions of following replacements (in a “single” replacement run) after a replacement has been done?

@Sascha S, it seems so.

[quote=292777:@Lars Lehmann]Feedback don’t work for me, because I’m behind a proxy…

Another annoying point.[/quote]
The new version of feedback should. We used the new httpsocket which automatically uses the system proxy settings.

That’s totally clbuttic.

Did you have regex turned on?

RegEx wouldn’t work without escaping the parenthesis. It would show no matches.

I wonder what the secret sauce is here? I tried to recreate this in a simple project and could not.

It works from the last match to the first just so this should not matter
But I cant replicate this so …

I’ve seen something like this… no regex though.
To reproduce:

  1. do a search
  2. change some code before the result
  3. do a replace all

example:

dim i as integer for i =0 to 100 dosomething next

find “i”
add a space at the beginning of the code.
replace all with “x”
result:

ximxi asxinteger for x =0 to 100 dosomethxng next

or add a carriage return at the start=

xintxegerx for i =0xto 100 dosomething next
after “undo” I get

integerxfor i =0xto 100 dosoiething

Xojo 2016r1.1

[quote=292898:@jim mckay]I’ve seen something like this… no regex though.
To reproduce:

  1. do a search
  2. change some code before the result
  3. do a replace all
    [/quote]

<https://xojo.com/issue/45316>

Would it be possible to just disable the replace functions if anything has changed since the search was executed?

Not at the moment since this assumes we keep track of the time the search was done on each search result to know if you changed anything in the item the result represents since the search was done
We dont

Doesn’t mean “and we never will”
Just we dont right now

I think the suggestion is to disable the replace buttons if anything in the code editor changes. It wouldn’t matter if the search results are affected by the change or not.

What’s worse, if I create a new project, add an open event to the default window, do a global find “i”, add a space to the event then replace-all with “x”… it gets ugly. hit undo and kaboom Xojo crashes hard.
(I hope I saved my work in the other project I had open… whew I did)

Right… I would think anything that would cause a document to need saving could be a trigger to disable the replace functions. Search would enable them again until something changes.

you’d have to save before you could search again ?

I think they’re suggesting you’d have to save or re-search before you could replace.
Noooot really a fan of the idea, search and replace shouldn’t be complicated for the user.
I would think a smarter search and replace would be a better idea than a bandaid like inhibiting my replace.