[wingide-users] Replace in selection
Wingware Support
support at wingware.com
Mon Aug 8 16:33:09 EDT 2005
Gigi wrote:
> One thing that bothered me in WingIDE is that it is not possible to
> perform replace in the selected test only. This is the most useful
> mode IMO and it's the default in many IDEs. I noticed a thread from
> April 2005 (search/replace revisited...again) that addresses the same
> problem. Well, luckilly WingIDe is scriptable and it turned out that
> is is pretty simple to extend it to support replace in selection.
Thanks! It works as advertised after fixing one typo in the script.
The replace_in_selection function should be:
def replace_in_selection(what, with_what):
"""Replaces 'what' with 'with_what' in the current selection only"""
def transform(text):
return text.replace(what, with_what)
app = wingapi.gApplication
editor = app.GetActiveEditor()
_transform_selection(editor, transform)
We still intend to add this functionality to the builtin search and
replace tools.
John
More information about the wingide-users
mailing list