Skip to content
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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

sim642
Copy link
Member

@sim642 sim642 commented Oct 4, 2019

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 the active 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!

(ptr_layout_buffer->active == 1) ?
_(" (active)") :
(ptr_layout_buffer->active == 2) ?
_(" (zoomed)") : "");
Copy link
Member Author

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))
Copy link
Member Author

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-io
Copy link

codecov-io commented Oct 4, 2019

Codecov Report

Merging #1412 into master will increase coverage by 0.46%.
The diff coverage is 9.37%.

Impacted file tree graph

@@            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
Impacted Files Coverage Δ
src/core/wee-upgrade.c 0% <ø> (ø) ⬆️
src/core/wee-config.c 46.38% <0%> (+0.12%) ⬆️
src/core/wee-command.c 5.3% <0%> (ø) ⬆️
src/gui/gui-buffer.c 29.73% <18.18%> (ø) ⬆️
src/gui/gui-layout.c 4.05% <8.33%> (+0.14%) ⬆️
src/core/wee-completion.c 6.58% <0%> (-0.14%) ⬇️
src/plugins/irc/irc-notify.c 6.56% <0%> (ø) ⬆️
src/plugins/irc/irc-server.c 8.7% <0%> (ø) ⬆️
src/plugins/irc/irc-info.c 7.55% <0%> (ø) ⬆️
src/plugins/xfer/xfer-file.c 0% <0%> (ø) ⬆️
... and 16 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4b0e6d5...67328aa. Read the comment docs.

@flashcode flashcode added the feature New feature request label Oct 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants