# PythonEditor "Find and Replace" bug?

**URL:** <https://discourse.mcneel.com/t/pythoneditor-find-and-replace-bug/5851>\
**Category:** Scripting\
**Created:** [February 10, 2014, 1:50pm UTC](https://discourse.mcneel.com/t/pythoneditor-find-and-replace-bug/5851 "2014-02-10T13:50:06Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Holo](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/holo/32/496872_2.png) [@Holo](https://discourse.mcneel.com/u/Holo)\
**Post date:** [February 10, 2014, 1:50pm UTC](https://discourse.mcneel.com/t/pythoneditor-find-and-replace-bug/5851/1 "2014-02-10T13:50:06Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Helvetosaur](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/helvetosaur/32/635974_2.png) [@Helvetosaur](https://discourse.mcneel.com/u/Helvetosaur)\
**Post date:** [February 10, 2014, 2:17pm UTC](https://discourse.mcneel.com/t/pythoneditor-find-and-replace-bug/5851/2 "2014-02-10T14:17:46Z")

</div>

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.

😡 😡 😡

–Mitch

---

<div class="post-metadata">

**Author:** ![Peter](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/peter/32/332817_2.png) [@Peter](https://discourse.mcneel.com/u/Peter)\
**Post date:** [February 10, 2014, 3:16pm UTC](https://discourse.mcneel.com/t/pythoneditor-find-and-replace-bug/5851/3 "2014-02-10T15:16:24Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Helvetosaur](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/helvetosaur/32/635974_2.png) [@Helvetosaur](https://discourse.mcneel.com/u/Helvetosaur)\
**Post date:** [February 10, 2014, 3:47pm UTC](https://discourse.mcneel.com/t/pythoneditor-find-and-replace-bug/5851/4 "2014-02-10T15:47:08Z")

</div>

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

–Mitch

---

<div class="post-metadata">

**Author:** ![Holo](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/holo/32/496872_2.png) [@Holo](https://discourse.mcneel.com/u/Holo)\
**Post date:** [February 10, 2014, 3:53pm UTC](https://discourse.mcneel.com/t/pythoneditor-find-and-replace-bug/5851/5 "2014-02-10T15:53:24Z")

</div>

@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.

---

<div class="post-metadata">

**Author:** ![Peter](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/peter/32/332817_2.png) [@Peter](https://discourse.mcneel.com/u/Peter)\
**Post date:** [February 10, 2014, 4:02pm UTC](https://discourse.mcneel.com/t/pythoneditor-find-and-replace-bug/5851/6 "2014-02-10T16:02:10Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Helvetosaur](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/helvetosaur/32/635974_2.png) [@Helvetosaur](https://discourse.mcneel.com/u/Helvetosaur)\
**Post date:** [February 10, 2014, 4:08pm UTC](https://discourse.mcneel.com/t/pythoneditor-find-and-replace-bug/5851/7 "2014-02-10T16:08:47Z")

</div>

> [@Peter](#):
>
> 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.

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

---

<div class="post-metadata">

**Author:** ![stevebaer](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/stevebaer/32/473567_2.png) [@stevebaer](https://discourse.mcneel.com/u/stevebaer)\
**Post date:** [February 10, 2014, 4:25pm UTC](https://discourse.mcneel.com/t/pythoneditor-find-and-replace-bug/5851/8 "2014-02-10T16:25:46Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![stevebaer](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/stevebaer/32/473567_2.png) [@stevebaer](https://discourse.mcneel.com/u/stevebaer)\
**Post date:** [February 10, 2014, 4:26pm UTC](https://discourse.mcneel.com/t/pythoneditor-find-and-replace-bug/5851/9 "2014-02-10T16:26:04Z")

</div>

> [@Helvetosaur](#):
>
> a way to pre-load some code

What do you need this for Mitch?

---

<div class="post-metadata">

**Author:** ![Helvetosaur](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/helvetosaur/32/635974_2.png) [@Helvetosaur](https://discourse.mcneel.com/u/Helvetosaur)\
**Post date:** [February 10, 2014, 4:38pm UTC](https://discourse.mcneel.com/t/pythoneditor-find-and-replace-bug/5851/10 "2014-02-10T16:38:46Z")

</div>

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

```python
#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

---

<div class="post-metadata">

**Author:** ![Holo](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/holo/32/496872_2.png) [@Holo](https://discourse.mcneel.com/u/Holo)\
**Post date:** [February 10, 2014, 4:40pm UTC](https://discourse.mcneel.com/t/pythoneditor-find-and-replace-bug/5851/11 "2014-02-10T16:40:12Z")

</div>

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

```python
# 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.

---

<div class="post-metadata">

**Author:** ![Helvetosaur](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/helvetosaur/32/635974_2.png) [@Helvetosaur](https://discourse.mcneel.com/u/Helvetosaur)\
**Post date:** [February 10, 2014, 4:51pm UTC](https://discourse.mcneel.com/t/pythoneditor-find-and-replace-bug/5851/12 "2014-02-10T16:51:09Z")

</div>

> [@Holo](#):
>
> Editpy… to get it back up

Mine minimizes to the Windows taskbar…

---

<div class="post-metadata">

**Author:** ![Holo](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/holo/32/496872_2.png) [@Holo](https://discourse.mcneel.com/u/Holo)\
**Post date:** [February 10, 2014, 4:54pm UTC](https://discourse.mcneel.com/t/pythoneditor-find-and-replace-bug/5851/13 "2014-02-10T16:54:13Z")

</div>

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… 😃

---

<div class="post-metadata">

**Author:** ![Helvetosaur](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/helvetosaur/32/635974_2.png) [@Helvetosaur](https://discourse.mcneel.com/u/Helvetosaur)\
**Post date:** [February 10, 2014, 4:55pm UTC](https://discourse.mcneel.com/t/pythoneditor-find-and-replace-bug/5851/14 "2014-02-10T16:55:51Z")

</div>

> [@Holo](#):
>
> I have become pretty darn fast at typing editpy fast though…

I have aliases es for EditScript and ep for EditPythonScript…

–Mitch

---

<div class="post-metadata">

**Author:** ![stevebaer](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/stevebaer/32/473567_2.png) [@stevebaer](https://discourse.mcneel.com/u/stevebaer)\
**Post date:** [February 10, 2014, 5:03pm UTC](https://discourse.mcneel.com/t/pythoneditor-find-and-replace-bug/5851/15 "2014-02-10T17:03:54Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![piac](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/piac/32/769366_2.png) [@piac](https://discourse.mcneel.com/u/piac)\
**Post date:** [February 11, 2014, 6:10pm UTC](https://discourse.mcneel.com/t/pythoneditor-find-and-replace-bug/5851/16 "2014-02-11T18:10:31Z")

</div>

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](mailto:giulio@mcneel.com)

---

<div class="post-metadata">

**Author:** ![Holo](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/holo/32/496872_2.png) [@Holo](https://discourse.mcneel.com/u/Holo)\
**Post date:** [February 11, 2014, 8:01pm UTC](https://discourse.mcneel.com/t/pythoneditor-find-and-replace-bug/5851/17 "2014-02-11T20:01:10Z")

</div>

Hi Piac, fixing this might do the trick. If it works it works, right? 😄  
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

---

<div class="post-metadata">

**Author:** ![stevebaer](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/stevebaer/32/473567_2.png) [@stevebaer](https://discourse.mcneel.com/u/stevebaer)\
**Post date:** [February 27, 2014, 2:27am UTC](https://discourse.mcneel.com/t/pythoneditor-find-and-replace-bug/5851/18 "2014-02-27T02:27:40Z")

</div>

Giulio’s fixes for this will be in SR9

---

<div class="post-metadata">

**Author:** ![piac](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/piac/32/769366_2.png) [@piac](https://discourse.mcneel.com/u/piac)\
**Post date:** [February 27, 2014, 5:33pm UTC](https://discourse.mcneel.com/t/pythoneditor-find-and-replace-bug/5851/19 "2014-02-27T17:33:39Z")

</div>

These are the planned fixes for SR9:

[http://mcneel.myjetbrains.com/youtrack/issue/RH-24794](http://mcneel.myjetbrains.com/youtrack/issue/RH-24794)

---

<div class="post-metadata">

**Author:** ![Helvetosaur](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/helvetosaur/32/635974_2.png) [@Helvetosaur](https://discourse.mcneel.com/u/Helvetosaur)\
**Post date:** [June 4, 2014, 5:16pm UTC](https://discourse.mcneel.com/t/pythoneditor-find-and-replace-bug/5851/20 "2014-06-04T17:16:38Z")

</div>

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

–Mitch
