This repository has been archived by the owner on Dec 11, 2023. It is now read-only.
fix(stacking_window): stabilize window widths on navigation #69
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.
Context
The order of stacked windows is: menu, details, diff. The stacking window width was set sequentially for each window and relied only on the buffer content of the last window and the current window. This meant that when the diff window content was wider than the details window content, the diff window resized all windows in its stack (menu, details) to match the width of the diff window.
Problem
This logic ignores the fact that the menu window could be wider than the details window. In such a situation, when the details window was being opened, it adjusted its width to match the width of the wider menu window. However, since the diff window only looked at buffer contents of the details window, and not at the actual window width of the details window, it assumed that the diff window is the widest one, and set the width of the menu window and the details window to match the diff window. This makes the menu window narrower than its content.
Kapture.2023-11-28.at.11.47.41.mp4
Solution
Change the
StackingWindow:after_opened()
window resize logic to look at the actual window width, rather than the buffer content width. Whenafter_opened()
runs for the diff window, it correctly can identify that the details window was resized due to the menu window being wider, and correctly makes all windows' width bemax(diff window, previous windows)
.Kapture.2023-11-28.at.11.50.35.mp4
Fixes #52