Description
hello,
if you have folded some code in a sketch, the IDE eats unpredictable amounts of the code when applying a search and replace action.
you can see for yourself by executing the following steps:
- freshly open arduino IDE
- create a new sketch (file->new or Datei->Neu or STRG-N)
- fold both the setup and the loop routine code
- use the search-function (STRG-F) and replace a word of your favour, e.g. replace "code" with "cidre"
- it doesnt matter wheather you use case sensitive or insensitive search
- hit "Replace All"-button of the search and replace dialog window
first you will notice, that the IDE does some computing, and then the folded "void loop() {" disappears.
second - if you save the file in this condition, the eaten code is finally gone.
third - if you try UnDo and ReDo (before saving), some unpredictable behaviour appears on the code. furthermore, you are not able to restore the original code as it existed before search and replace action.
and last but not least the search and replace fails with replacing the word "code" which is located in the disabled ( /* ) second line (unfolded condition).
this bug is a bit of subtle and did cost me hours of searching errors, caused by literally an erosion of code...
additionally, i think the bug has a history of some arduino versions, because my first irritations about eroded code date back to late 2014 when my projects grew larger so that i began to use code folding.
i am using a german language arduino 1.6.8 on a windows 7 64bit PC, 16 GB RAM, core-i5 3570K.
the user-account-type is local administrator, no domain.
the arduino-folder is at the default location.
thanks for helping!
regards