Additional Option '-owner' for Embedded Window

-owner boolean

If true then the text widget is the owner of the embedded window. Only if it is the owner the window will be destroyed if the range of text containing the embedded window is deleted, and the deleted text is not saved on undo stack. Per default this option is true. Setting this option to false should be done with care, because in this case the text widget is not responsible for the lifetime of the embedded window.

This supports the clear command. When clearing the text widget all embedded windows owned by the text widget will be destroyed, a re-use is not possible. When setting the ownership to false, it is possible to re-use an embedded window after clearing the widget.

There exists no other way for the re-use of embedded windows, except with an inconvenient work-around: before clearing the widget, traverse all embedded windows and set option -window to an empty string. With option -owner the re-use can be already ensured at the time of embedding.