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

Refactor statusline elements to build Spans #9122

Merged
merged 2 commits into from
Mar 19, 2024

Conversation

hamrik
Copy link
Contributor

@hamrik hamrik commented Dec 19, 2023

The current statusline implementation uses ad-hoc write callbacks to render statusline elements. This make statusline elements hard to work with, because we get no useful information about their output.

This PR refactors these elements to work more like widgets: each render_* function returns a Spans, which can be combined into a complete statusline. This has remained the responsibility of the render function.

This PR also separates the render function into two parts: render_statusline combines the aforementioned elements into one large Spans with given size constraints, while render blits it to a given Surface as it has done so previously.

The rationale behind this is to allow post-processing the widget outputs and to make decisions based on them.
For example, in the future we can now check if the statusline is empty and autohide it. Or revisit #7310 and automatically space the elements.

This is merely a refactor; the current apparent behavior of each statusline element should be identical to previous versions.

@hamrik hamrik force-pushed the statusline_spans branch 2 times, most recently from f33c807 to 57abe53 Compare December 19, 2023 23:44
@kirawi kirawi added C-enhancement Category: Improvements A-helix-term Area: Helix term improvements labels Dec 22, 2023
@hamrik hamrik force-pushed the statusline_spans branch 2 times, most recently from 083cca0 to f85c996 Compare January 27, 2024 19:45
@archseer archseer added this to the next milestone Jan 28, 2024
@hamrik hamrik force-pushed the statusline_spans branch 2 times, most recently from 6245d05 to 2eb1a91 Compare March 8, 2024 19:56
archseer
archseer previously approved these changes Mar 19, 2024
the-mikedavis
the-mikedavis previously approved these changes Mar 19, 2024
@the-mikedavis
Copy link
Member

This just needs a rebase / master merge to resolve the conflicts

@the-mikedavis the-mikedavis modified the milestones: next, 24.03 Mar 19, 2024
@hamrik
Copy link
Contributor Author

hamrik commented Mar 19, 2024

Rebase done!

@pascalkuthe pascalkuthe merged commit bcf7b26 into helix-editor:master Mar 19, 2024
6 checks passed
@hamrik hamrik deleted the statusline_spans branch March 19, 2024 17:49
Desdaemon pushed a commit to Desdaemon/helix that referenced this pull request Mar 26, 2024
* Refactor statusline elements to return Spans

* Split render fn to build Spans and blit to Surface
postsolar pushed a commit to postsolar/helix that referenced this pull request Apr 4, 2024
* Refactor statusline elements to return Spans

* Split render fn to build Spans and blit to Surface
postsolar pushed a commit to postsolar/helix that referenced this pull request Apr 4, 2024
* Refactor statusline elements to return Spans

* Split render fn to build Spans and blit to Surface
postsolar pushed a commit to postsolar/helix that referenced this pull request Apr 4, 2024
* Refactor statusline elements to return Spans

* Split render fn to build Spans and blit to Surface
postsolar pushed a commit to postsolar/helix that referenced this pull request Apr 20, 2024
* Refactor statusline elements to return Spans

* Split render fn to build Spans and blit to Surface
hamrik added a commit to hamrik/helix that referenced this pull request Apr 30, 2024
mtoohey31 pushed a commit to mtoohey31/helix that referenced this pull request Jun 2, 2024
* Refactor statusline elements to return Spans

* Split render fn to build Spans and blit to Surface
Vulpesx pushed a commit to Vulpesx/helix that referenced this pull request Jun 7, 2024
* Refactor statusline elements to return Spans

* Split render fn to build Spans and blit to Surface
Vulpesx pushed a commit to Vulpesx/helix that referenced this pull request Jun 7, 2024
Chirikumbrah pushed a commit to Chirikumbrah/helix that referenced this pull request Jun 15, 2024
smortime pushed a commit to smortime/helix that referenced this pull request Jul 10, 2024
* Refactor statusline elements to return Spans

* Split render fn to build Spans and blit to Surface
smortime pushed a commit to smortime/helix that referenced this pull request Jul 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-helix-term Area: Helix term improvements C-enhancement Category: Improvements
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants