We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
Page Index Toggle Pages: 1
Find !!! (Read 1828 times)
Find !!!
Apr 11th, 2008, 1:46am
 
I was just wondering, why is the 'Find' in processing so basic? Why can't I search 'Whole word' ? If I have to search for a variable named 'M', it will search in the whole program wherever it finds M. I can reduce it slightly by matching the case, but does it suffice? There are still 100s of capital Ms in a program... (Please don't suggest "don't keep variable names which are contained in other words")

Thanks !
Re: Find !!!
Reply #1 - Apr 11th, 2008, 10:15am
 
Hi,

Variables really shouldn't be named something like 'M' - simply for the reason you mentioned as well as for others (readability, if nothing else). If someone else was to read your code, how would they know what 'M' was or what it was used for without trawling through it's instantiation and use?
Beyond that, I can't recall whether the processing IDE allows regular expression searches but that's an option to explore.

cheers,

Ryan
Re: Find !!!
Reply #2 - Apr 11th, 2008, 12:54pm
 
I knew people would say that that's why had already written the same. Anyway, I'm aware of the coding guidelines but there are some cases when symbols have their special meaning and variables like M directly represent the physical quantity we are simulating. For you, take another example .. take the loop variable 'i' and the need of such thing will be more clear. I will keep on clicking Ctrl. G (Find Next) hundreds of times to go with each i in every variable and every comment.
Re: Find !!!
Reply #3 - Apr 11th, 2008, 4:50pm
 
Search for "int i" if you use i in loop or such. Or search for "M=" or "int M" or "(M" to find the variable M in usage.
Re: Find !!!
Reply #4 - Apr 11th, 2008, 5:04pm
 
My fault I asked. (People here are assuming I don't know the work arounds, but that is not the case) Of course I can come up with more examples when that is needed(but not ABSOLUTE NECESSITY, as Find in itself is not an absolute necessity.), but I guess there's no point...
Thanks.
Re: Find !!!
Reply #5 - May 15th, 2008, 4:54pm
 
Well, the editor in Processing is a bit.. primitive.
I do most of my editing, except some little syntax corrections, in an external editor (SciTE).
I don't like activating the corresponding options as it disables the editing in Processing.
I would appreciate if Processing was automatically detecting an update of the file it edits, asking the user if both the file is changed and the in buffer code isn't saved, and reloading without question (or with one) otherwise.
Re: Find !!!
Reply #6 - May 15th, 2008, 5:03pm
 
Yeah ... I do the same ... I use Visual Studio 2005 editor for doing all my special editing, finding replacing stuff - which allows regular expressions and all... quite cool that is ... that has very good features like find in selection, find in document, find in complete project, find in all open tabs(which I would wish was in processing also, but... Smiley ) Just that it takes time to open so I keep one instance of VS2005 open and just drag the file there Smiley

And more importantly, when you press Ctrl. Z in ALL other editors of the world, they take you to the place where that is happening...
Re: Find !!!
Reply #7 - May 16th, 2008, 5:06pm
 
If you try SciTE (http://www.scintilla.org), you will find it has quite the same behavior than Visual Studio (v.6, actually). Author tried to mimic a quite common, and not so bad interface.
And it starts instantly! Wink

Personally, I wouldn't push too hard the authors of Processing to improve the editor, because it will never be as powerful as a specialized editor, and it will never please everybody anyway.
Just ask what is the best text editor in a programmer's forum or mailing list, and you will have almost a different one per answer... With some passionate and partial messages.

That's why I suggested to improve the reload mechanism. Currently, the fastest way is to click on the Open icon, and select the current sketchbook. It would be nice to have a menu item, a button and a keyboard shortcut to automatically reload the current sketch. I don't even ask anymore an automatic detection of file change and reload! Wink
Re: Find !!!
Reply #8 - May 17th, 2008, 6:07pm
 
Piyush Soni wrote on Apr 11th, 2008, 1:46am:
I was just wondering, why is the 'Find' in processing so basic

Because nobody has contributed code to improve it, and since I'm the only one working on the editor, there are higher priorities than adding a "whole word" option to Find. Contributions are always very welcome.
Re: Find !!!
Reply #9 - May 17th, 2008, 6:52pm
 
Yes, I can do that this summer if I get time ...
Page Index Toggle Pages: 1