I'm sorry no one has suggested a better way to make the changes permanent. How does Leo-Editor notice that typing has inserted a few more characters? Couldn't the same mechanism be used here?
On 04/17/2013 12:29 PM, Terry Brown wrote:> I think that's the way, see also: > > https://groups.google.com/forum/?fromgroups=#!searchin/leo-editor/insert$20text$20will$20disappear$20after$20insert$20children$20node$20and$20redraw/leo-editor/0haTWrUlNVg/lFU1JkMHrosJ > Thanks. I vaguely remembered this thread, but I couldn't find it. > Depending on your use you might want to > > oldins = w.getInsertPoint() > > ... > > w.setInsertPoint(oldins+len(inserted_text)) http://pastebin.com/GAc15jRL uses both w.getInsertPoint() and w.setInsertPoint() > > to get the cursor where you want it afterwards, lots of variations how > the new position might be calculated. > > Other possibly useful methods: > > i,j = w.getSelectionRange(sort=True) > s = w.getSelectedText() Yes, these are very useful. -- You received this message because you are subscribed to the Google Groups "leo-editor" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/leo-editor?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
