PythonEditor "Find and Replace" bug?


#1

I have tried to replace stuff with the Find and Replace tool, but I find it buggy.I can not get it to “replace all”. Does it work in-house?


#2

It’s a real PITA, I have complained about it in the past as well… I basically gave up using it, it’s so bad.

How doesn’t work:

Pre-select something, open Find and Replace, the Find box is already filled in, check “Replace all”, type something in the replace box and hit Replace button: only the first instance is replaced.

Pre-select something, open Find and Replace, the Find box is already filled in, type something in the replace with box first, then check “Replace all”, hit Replace button: everything found that matches the Find box is replaced by NOTHING (blank), because when you checked “replace all” it erased the entry in the replace with box and you didn’t notice…

Pre-select something, open Find and Replace, the Find box is already filled in, let’s say “Replace all” is already checked. Type in a value in the “replace with” field and hit Replace. Only the first instance of the found item is replaced - AND the replace entry (top box) gets deleted and replaced by the “replace with” value…!!!

How it does work:

Blank both the Find and Replace with fields and check “replace all”. Now type in the values for find and replace with. Hit the replace button. Works correctly. As far as I can tell, this is the only way it works, and you have to type in both values, you can’t use the autofill function for the Find field.

:rage: :rage: :rage:

–Mitch


#3

What are you trying to replace, it does not happen to be layer names does it?


#4

No, this is the find and replace function in the editor itself - when you are writing code.

–Mitch


#5

@Helvetosaur thanks for the info.
Being able to replace names are critical for efficient work on scripts. Hope they fix it soon as it is no longer in wip.


#6

I would agree most definitely. Although I mostly write my code in Notepad++ .
Though I can see the benefit of coding in rhino with the Library of commands in the same page. And auto-suggestions when using python rs.** etc.

This does sound like a quite severe issue/bug for a coding editor.


#7

No only that but there are is auto-suggestion of ALL the modules loaded into the script (RhinoCommon, scriptcontext, any external modules you add like random, math, etc…

AND, the debugger is fantastic. You can learn a LOT about what your code is doing from it. I would not even try doing most of the stuff I do without that.

The only thing that is wrong in fact with the Python editor - aside from the aforementioned find and replace function - is that it doesn’t have a way to pre-load some code when you open a new document, and that it doesn’t run on Mac yet.

–Mitch


(Steve Baer) #8

@piac, do you know about this issue with Find/Replace?


(Steve Baer) #9

What do you need this for Mitch?


#10

A little like the vb Rhinoscript header, it would be nice to open a new document with the following already in:

#customize the following to what you want
import rhinoscriptsyntax as rs
import scriptcontext as sc
import Rhino
"""Script by <insert author>, Version <insert date>"""

Just easier if all that pops in without having to type it every time.

–Mitch


#11

In the scripteditor we had the option to put in a “header”/"template"so in this case we could start any new script with:

# script written by Holo
# Copyright by Holografisk

import rhinoscriptsyntax as rs
import Rhino

I agree that it would be nice to have that option.

I also miss the floating bar where RhinoScript minimizes to. If we minimize Python now we have to type Editpy… to get it back up.


#12

Mine minimizes to the Windows taskbar…


#13

You are so right… it stacks with the Rhino icon…
I did know that… embarrasing to not connect those two dots… I have become pretty darn fast at typing editpy though… :smiley:


#14

I have aliases es for EditScript and ep for EditPythonScript…

–Mitch


(Steve Baer) #15

There are a lot of separate issues in this thread and I feel that I may be getting lost. Here’s what I believe are the issues

  1. Replace All in the script editor has bugs and does not appear to work all of the time
  2. The is a wish for a “script from template” feature so you can have your standard boilerplate set up when you begin a script
  3. The python editor minimizes to the taskbar which is different than the RhinoScript editor. The preferred behavior is like the RhinoScript editor.

Is this the complete list for this thread? Am I missing anything?


(Giulio Piacentino) #16

Ooops! Thanks @Holo for the report and Mitch for this precise description! I missed your complaints before but they are very reasonable.

It seems that the “Find & Replace” dialog urgently requires attention. I think it no longer works as intended, because of one subtle bug: when it is open, its content is still replaced with what the user is selecting.

I do not know how or at which point this issue infiltrated the code. Sorry – we’ll get this fixed. This alone appears to me to be the cause of the confusing behavior. Do you think this would actually suffice to make the dialog useful again?

Thanks for letting us know about this issue.

Giulio

Giulio Piacentino
for Robert McNeel & Associates
giulio@mcneel.com


#17

Hi Piac, fixing this might do the trick. If it works it works, right? :smile:
Also make sure tagging the “replace all” option doesn’t clear out the replace field.

And update “Find” in the menu to “Find and Replace”.

Thanks


(Steve Baer) #18

Giulio’s fixes for this will be in SR9


(Giulio Piacentino) #19

These are the planned fixes for SR9:

http://mcneel.myjetbrains.com/youtrack/issue/RH-24794


#20

I did a lot of finding and replacing today in the SR9 RC and it is working MUCH better, thanks!!!

–Mitch