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

fix: ensure fat headlines are not shifted by conflicting extmarks #70

Merged

Conversation

PriceHiller
Copy link
Contributor

Copied from the body of the commit message:

This commit makes headlines.nvim compatible with Nvim Orgmode's new Virtual Indent option added by nvim-orgmode/orgmode#627.

This also will ensure any features like it in the future from other plugins do not interfere with the headlines later on.

In theory, extmark priorities would work here, but in pratice they do not. If this extmark is set last by a higher priority using only the virtual text, it can be arbitrarily shifted by other extmark content and the same occurs when the extmark set is of a lower priority. By specifying the window column to apply to, we bypass all the priorities shenanigans and directly set the correct position of the headline.

TL;DR:

Adds compat with virtual indents in Nvim Orgmode.

Before this change:
image
Notice the weird indents on lines 2, 3, 5, 6, and 8. Those result from a conflicting extmark set by Nvim Orgmode trying to set virtual indentation.

After this change:
image

Now headlines.nvim directly sets the window column to apply to instead of battling with other extmarks on virtext. (As a note, extmark priorities are not a solution in this case afaik, see the commit message body paragraph 3 for more details.)

This commit makes `headlines.nvim` compatible with Nvim Orgmode's new
Virtual Indent option added by
nvim-orgmode/orgmode#627.

This also will ensure any features like it in the future from other
plugins do not interfere with the headlines later on.

In theory, extmark priorities would work here, but in pratice they do
not. If this extmark is set *last* by a higher priority using only the
virtual text, it can be arbitrarily shifted by other extmark content and
the same occurs when the extmark set is of a lower priority. By
specifying the window column to apply to, we bypass all the priorities
shenanigans and directly set the correct position of the headline.
Copy link
Owner

@lukas-reineke lukas-reineke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks 🚀

@lukas-reineke lukas-reineke merged commit 4416ee8 into lukas-reineke:master Feb 29, 2024
2 of 3 checks passed
@PriceHiller PriceHiller deleted the fix/headline-win-col branch February 29, 2024 02:26
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