Ready to make pull request #8
Merged
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 pull request brings two new functionality,
resize_openandresize_close.Problem
The problems I would like to solve is the following.
Normally, if you close window D in the below configuration, the height of window D goes to A and C.
This, at least to me, is strange as I would expect the the height and to be evenly distributed as between B and C
The same goes for opening a new window. For example, if you open toggleterm in vertical direction (windows D in the below figure), the initial windows will go out of proportion.
I expected the width of A and B/C to have the same width as their width proportion was the same before toggling the new windows.
I first notice this phenomena when using toggleterm as shown below.
without_bufresize.mov
Solution
Initially, I was planning to make a new extension to solve this problem. However, I found out that it shares a lot of codebase with
bufresize.nvim, thus I am adding this functionality in this plugin.The two new functions are
resize_openandresize_close. Below is the configuration to solve the problem above.resize_open: find the newly opened window that is in the current state but not in the registered state, adjust the proportion of registered windows accordingly, then apply resize to the registered windows. Should be use withblock_registerto prevent race conditionresize_close: find the newly closed window that is not in the registered state but not in the current state, adjust the proportion of registered windows accordingly, then apply resize to the registered windows. Should be use withblock_registerto prevent race conditionA complete list of functions are listed in the README.
With this setup, below is the new behavior.
with_bufresize.mov