Add clear method to LTerm_widget.box#44
Open
bonkf wants to merge 3 commits intoocaml-community:masterfrom
Open
Add clear method to LTerm_widget.box#44bonkf wants to merge 3 commits intoocaml-community:masterfrom
bonkf wants to merge 3 commits intoocaml-community:masterfrom
Conversation
bonkf
commented
Oct 9, 2016
| List.iter (fun child -> child.widget#set_parent None) children; | ||
| children <- []; | ||
| self#compute_size_request; | ||
| self#compute_allocations; |
Contributor
Author
There was a problem hiding this comment.
The calls to #compute_size_request and #compute_allocations are currently not needed since children is empty at this point; I wasn't sure if I could leave them out since some boxes may have custom implementations that depend on values other than children.
Contributor
Author
There was a problem hiding this comment.
Scratch that, they are still necessary, although they could theoretically be replaced with default values there is not much to be gained here.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds a method to clear all widgets from a
LTerm_widget.box.Writing
some_box#clearis easier and faster than writingsince the box only needs to be redrawn once.
I also updated my example from PR#42 to demonstrate the usage, although I'm not sure if there's any point in doing so; it's fairly self-explanatory and using
#clearin this case isn't even the fastest way to do it (see the comment indouble_editor.ml).