vessillo / foxreplace

Automatically exported from code.google.com/p/foxreplace
0 stars 0 forks source link

Can't swap words. #61

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a rule to replace keyboard with leopard.
2. Create a rule to replace leopard with keyboard.
3. Load a page containing "Keyboard".

What is the expected output? What do you see instead?
All instances of Kaybard replaced with Leopard.

What version of the product are you using? On what operating system?
Firefox 11
Extensionj version 0.12.2

Please provide any additional information below.
Appears the second rule undoes the 1st.

Original issue reported on code.google.com by abdaw...@gmail.com on 19 Mar 2012 at 11:39

GoogleCodeExporter commented 9 years ago
This is because the rules are applied sequentally, not all at the same time. If 
you want to swap words you have to use a temporary substitution, e.g.:

1. "leopard" -> "temporaryWordThatYouKnowIsntInPage"
2. "keyboard" -> "leopard"
3. "temporaryWordThatYouKnowIsntInPage" -> "keyboard"

I don't intend to change this behaviour in the forseeable future because there 
may be people who depend on it, so I'll close the issue.

PS: I would have found the example somewhat weird if I hadn't read xkcd before 
seeing this ;)

Original comment by marc.r...@gmail.com on 19 Mar 2012 at 5:30