Add action to distribute height/width for all open/split editors - #50
Open
reidswanson wants to merge 1 commit into
Open
Add action to distribute height/width for all open/split editors#50reidswanson wants to merge 1 commit into
reidswanson wants to merge 1 commit into
Conversation
This commit adds an action that distributes the height and widths of split editors evenly. Note, this is not the same as setting the proportion of all Split elements equal to '0.5'. For example, in this new action a window with 2 vertical splits would assign proportions such that each editor gets 1/3 of the available space. Whereas, the current 'equalSizeSplitter' method would assign 50% of the space to one editor and 25% to each of the remaining two.
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.
I think this pull request addresses issue #8. It is not clear to me whether the
EqualSizeSplitaction is working as intended, namely to only equalize the active splitter or if it is supposed to equalize all of them. To avoid overwriting the existing behavior I created a new oneDistributeSplitSize(I know the name is not great), that distributes the height and width across all open splits/editors.As an example, consider a 3 column layout. The reason setting
proportion=0.5doesn't work is that it gives 50% of the space to one side of the layout tree (e.g., a single editor) and 50% to the other side (another splitter). Each of those splitters gets 50% of the remaining space, which is only 25% of the full space. That is why @nkgm noticed the layout looks like:To solve the issue you have to find out how many editors (of the same orientation) are under each branch (
firstandsecond). The "correct" proportion is the number under the 1st branch divided by the total number under both branches.For example, consider the following layout tree where
Sstands for a Split node,Vmeans vertical orientation,Hmeans horizontal andWmeans Window.S1(V) has 1 direct
Wchild, 1Wthat is reachable from edges connected by otherVnodes and 2Hnodes that are sub containers for other editors. 3 of the 4 leaves are in the first branch so the proportion to give to the splitter is 0.75.So, the tree above would produce a layout like this:
I am new to Kotlin and Pull Requests, so forgive any unintentional faux pas.