Replace seems not to work?

Given this code:

function setup() print("Braitenberg Vehicle Experiment") objects = {} b1 = {} table.insert(b1, BVehicle1:partial(BVehicle1.behaveDefaultMotion, 1, 1)) table.insert(b1, BVehicle1.behaveJitter) table.insert(b1, BVehicle1.behaveAvoidWall) table.insert(objects, BVehicle1(b1, 600,400,0)) table.insert(objects, BVehicle1(b1, 400,600,0)) table.insert(objects, BVehicle1(b1, 800,400,0)) table.insert(objects, BVehicle1(b1, 400,800,0)) table.insert(objects, BVehicle1(b1, 100,500,0)) table.insert(objects, BVehicle1(b1, 200,700,0)) table.insert(objects, BVehicle1(b1, 300,300,0)) table.insert(objects, BVehicle1(b1, 400,200,0)) b2 = {} table.insert(b2, BVehicle1:partial(BVehicle1.behaveDefaultMotion, 1, 1.1)) table.insert(b2, BVehicle1.behaveJitter) table.insert(b2, BVehicle1.behaveSeekFood) table.insert(objects, BVehicle1(b2, 400,400, 0)) food = Food(300,900) end

Using the search thing, putting b1 in find and bAvoidWall in replace and selecting Replace All, it says it’s going to replace 12, replaces 4 times, and you get this:

`
function setup()
print(“Braitenberg Vehicle Experiment”)
objects = {}
bAvoidWalls = {}

table.insert(bAvoidWalls, BVehicle1:partial(BVehicle1.behaveDefaultMotion, 1, 1))

table.insert(b1, BVehicle1.behavbAvoidWallsitter)

table.insert(b1, BVehicle1.behavbAvoidWallsvoidWall)

table.insert(objects, BVehicle1(bAvoidWalls, 600,400,0))

table.insert(objects, BVehicle1(bAvoidWalls, 400,600,0))

table.insert(objects, BVehicle1(b1, 800,400,0))
table.insert(objects, BVehicle1(b1, 400,800,0))
table.insert(objects, BVehicle1(b1, 100,500,0))
table.insert(objects, BVehicle1(b1, 200,700,0))
table.insert(objects, BVehicle1(b1, 300,300,0))
table.insert(objects, BVehicle1(b1, 400,200,0))
b2 = {}
table.insert(b2, BVehicle1:partial(BVehicle1.behaveDefaultMotion, 1, 1.1))
table.insert(b2, BVehicle1.behaveJitter)
table.insert(b2, BVehicle1.behaveSeekFood)
table.insert(objects, BVehicle1(b2, 400,400, 0))
food = Food(300,900)

end
`

Note the double spacing, and the odd creation of behavbAvoidWallsvoidWall and similar oddities.

At a guess, it’s not re-finding the change locations after substituting, or something like that. Anyway, very broken.

Thanks,

R

P.S. the code tick marks don’t seem to work right here, either. :slight_smile:

@RonJeffries I mentioned the search/replace problem on the first page of the Codea 2.7.5 (145) discussion.

I’m not finding anything that seems like the bug I’m reporting. Maybe I’m not looking in the right place.

@RonJeffries There’s multiple pages in that discussion. Below is what I posted on page 1. Also, use ~~~ before and after code ( not ` ) to format code correctly in the forum.

@Simeon The find/replace doesn’t work right. If I do a replace all, it finds all occurances, but only replaces the first one.

PS. It also looks like it creates blank lines and screws up other lines. It seems to replace random spots.

PS. It looks like it replaces the first occurance, adds a blank line and the replaces where it thinks the next occurance was but it’s not. Adds another blank line and replaces where it thinks the next occurance was but it’s not. So it ends up replacing the first occurance and then just screwing up stuff after that.

That’s it all right. Sure didn’t find it, though, even with search. Weird.
Gotcha on tildes, I mistakenly supposed the [code] button would work.

Sorry everyone — I’ll look into fixing this shortly for a point update to Codea. Not sure how I missed this.