[wingide-users] [scripting] overwriting selection

Luc Bourhis luc_j_bourhis at mac.com
Mon Jan 21 10:39:17 MST 2008

> Luc Bourhis wrote:
>> editor.GetSelection() returns the current selection but how would I  
>> overwrite it with a string in a script?
> Text modification is done through the document object.  I think you  
> want to use something like the following (untested) code:
>  doc = editor.GetDocument()
>  start, end = editor.GetSelection()
>  doc.DeleteChars(start, end)
>  doc.InsertChars(start, text)
> You also may or may not want to set the selection after inserting  
> the new text.

It works. Thanks! Actually, I have just noticed that I could have  
found the answer by myself if I had read through scripts/ 
editor_extensions.py inside Wing IDE 3 application folder.

Thanks again,

Luc Bourhis
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2425 bytes
Desc: not available
Url : /pipermail/wingide-users/attachments/20080121/21fb07e7/smime.bin

More information about the wingide-users mailing list