[wingide-users] Scripting Question
Wingware Support
support at wingware.com
Mon Jun 4 11:02:17 MDT 2007
James Reese wrote:
> I'm trying to write a script for Wing IDE 2.1.4 to delete all of the
> characters between the current cursor location and a character entered
> by the user. I was able to write a script that worked by executing the
> command "isearch-forward," but I was unable to figure out how to stop
> incremental searching after the first search. (I want the area at the
> bottom of the window into which the user enters the search text to go
> away automatically.) Executing the command "cancel" didn't work.
>
> Next I tried using executing the command "search-char," but it appears
> to work in an ansynchronous fashion. That is, the script doesn't wait
> for the user to enter the character to search for before executing the
> rest of the script.
>
> Any suggestions will be greatly appreciated.
This seems to work (although I only tested it in Wing 3.0):
def delete_to_typed_char():
app = wingapi.gApplication
app.ExecuteCommand('delete-next-move')
app.ExecuteCommand('search-char')
Bind this to a key and after pressing the key binding press the char
you want to delete to. There is no input buffer shown as for isearch-forward,
however. It just gets the character and does the deletion right away.
--
Stephan Deibel
Wingware | Python IDE
Advancing Software Development
www.wingware.com
More information about the wingide-users
mailing list