-
-
Notifications
You must be signed in to change notification settings - Fork 319
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gui: add active or zoomed merged buffer support to layout (issue #562) #1412
base: master
Are you sure you want to change the base?
Conversation
(ptr_layout_buffer->active == 1) ? | ||
_(" (active)") : | ||
(ptr_layout_buffer->active == 2) ? | ||
_(" (zoomed)") : ""); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if such three-way ternary operator is fine or should it be a global three-element array instead. I couldn't find another example of a three-way ternary in WeeChat but usually similar flag printing is done using ternary.
@@ -361,10 +367,12 @@ gui_layout_buffer_apply (struct t_gui_layout *layout) | |||
ptr_buffer = ptr_buffer->next_buffer) | |||
{ | |||
if ((gui_buffer_count_merged_buffers (ptr_buffer->number) > 1) | |||
&& (ptr_buffer->layout_number == ptr_buffer->number) | |||
&& (ptr_buffer->layout_number_merge_order == 0)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
layout_number_merge_order
might be completely unneeded now.
To be honest, it seems like it was unnecessary before as well because, as far as I understand, it was some kind of attempt to recover which buffer should be made active from a group of buffers with the same numbers, but it clearly accomplished nothing. There was no way to know that without saving it in the config.
Codecov Report
@@ Coverage Diff @@
## master #1412 +/- ##
==========================================
+ Coverage 27.22% 27.69% +0.46%
==========================================
Files 200 201 +1
Lines 81520 81919 +399
==========================================
+ Hits 22195 22684 +489
+ Misses 59325 59235 -90
Continue to review full report at Codecov.
|
Closes issue #562.
The main change in this PR is the added
active
field to layout buffers, which additionally gets stored and handled during layout apply. Since theactive
field for merged buffers is also used to indicate merged buffer zoom to a single buffer, it will also be persisted in the layout for free.Same is true for persisting layout during upgrade.
The secondary change in this PR is fixing
gui_buffer_unmerge_all
such that the unmerged buffers are in the same order as they were merged, not in the reverse order as before. This is used when applying layouts and is needed to make that idempotent and restore merged buffers in the correct order.Happy Hacktoberfest!