Log In  


If you create a new text editor using the gui library, the :detach() function of the returned editor doesn't work as you would expect it to, only detaching the content of the editor, not the editor itself. This is an issue if you create/remove a number of editors, as each created editor still uses a small amount of CPU even after being detached.

This is caused because :attach_text_editor() returns the content, not the container, but it is the container that is added to the gui.

There is a simple workaround for this - instead of using text_ed:detach(), use text_ed.parent:detach(), where text_ed is the variable holding what is returned from :attach_text_editor(). However, this is not very intuitive for the user.

A simple fix would be to overwrite the :detach() function for the content so that it detaches its parent instead. I can't see many instances where this would be an issue/you'd actually want to detach just the content?

Hope this helps!

1



[Please log in to post a comment]