Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

folded code permanently disappears by search and replace action #4845

Closed
MOOSFETT opened this issue Apr 10, 2016 · 5 comments
Closed

folded code permanently disappears by search and replace action #4845

MOOSFETT opened this issue Apr 10, 2016 · 5 comments
Assignees
Labels
Component: IDE user interface The Arduino IDE's user interface Type: Bug

Comments

@MOOSFETT
Copy link

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

@MOOSFETT MOOSFETT changed the title folded code gets eaten by search and replace action folded code permanently disappears by search and replace action Apr 12, 2016
@jsotola
Copy link

jsotola commented May 23, 2016

i observed same behaviour win7 x64
arduino 1.6.10 hourly build 2018/05/18 07:34

@facchinm
Copy link
Member

Nasty nasty bug, I never experienced it since I don't use code folding but it's there and it's ugly.
@matthijskooijman , do you have any idea? Maybe it could be solved by #4363 ?

@facchinm facchinm added Component: IDE user interface The Arduino IDE's user interface Type: Bug labels Jul 19, 2016
@matthijskooijman
Copy link
Collaborator

@facchinm, I can't think of the cause for this bug off-hand, but it might indeed be fixed by that PR. I'll make sure to keep this one in mind when continuing work on the editor.

@matthijskooijman matthijskooijman self-assigned this Jul 19, 2016
@lmihalkovic
Copy link

Last i knew, it did not. Pb is the search is very inadequate code.

@per1234
Copy link
Collaborator

per1234 commented Aug 1, 2016

If this isn't going to be fixed by the next release the code folding option should be removed until it is fixed. The feature is already practically useless for most sketches large enough to need it due to #3441.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: IDE user interface The Arduino IDE's user interface Type: Bug
Projects
None yet
Development

No branches or pull requests

6 participants