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

Respect minwidth for hunks and branch parts #1877

Merged
merged 4 commits into from
Feb 22, 2019

Conversation

maxnordlund
Copy link
Contributor

Hi, first let me thank you for an awesome vim plugin ❤️

This contains three related changes. First a fix to make hunks and branch respect minwidth instead of hard coding 100 and 120 respectively. I've done this very carefully to not break anything. Secondly a small tweak to allow advanced customization of the hunks. This just exposes the previously s: function get_hunks as get_raw_hunks.

Finally, and this is the one I'm a bit unsure of, I move the branch name shortening from head to get_head, which means b:airline_head isn't shortened anymore. All code inside this plugin are fine with this, as they only check if it's empty or not. But it's technically a breaking change, I think.

If you don't like a commit, it can be easily rebased away. I'm looking forward to your feedback.

This removes the hardcoded minwidth limits for both the `hunks` and
`branch` parts. It replaces these with safe accesses to the `minwidth`
setting as done by `airline#parts#define_minwidth`.
@chrisbra
Copy link
Member

Thanks looks good. One question: Why do you need get_raw_hunks()? If this is exposed to the public, it should be mentioned in the documentation. Would you mind adding a bit of documentation around the hunk extension? Thanks.

@maxnordlund
Copy link
Contributor Author

The get_hunks shortens the hunks depending on the size of the window, but if I want to do that myself I need get_raw_hunks. Well, you can set a really high minwidth I guess, but that seems kinda hacky.

I'll add some documentation, no problem.

This allows for advanced customization where the shortening of the
branch name is up to the caller, unlike before.

This change is observable from the outside, and as such can be
dangerous. But AFAIK it does not change the default behavior.
@maxnordlund
Copy link
Contributor Author

Done, and I also got a warning about trailing white spaces from airline so I fixed that as well :)

@chrisbra
Copy link
Member

Thanks!

@chrisbra chrisbra merged commit eb0ddf6 into vim-airline:master Feb 22, 2019
@maxnordlund maxnordlund deleted the resepct-minwidth-for-vcs branch February 22, 2019 11:22
YCbCr pushed a commit to YCbCr/vim-airline that referenced this pull request May 26, 2019
…-for-vcs

Respect minwidth for hunks and branch parts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants