Skip to content

fix alignment with concealed text #503

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mageOfstructs
Copy link

This fixes an alignment issue where table cells include concealed text, which doesn't get accounted for. This pr adds some code to the row() fn for extracting all highlight extmarks in the area of the cell and readjusts the col.width field. This also takes virtual_text into account.

@MeanderingProgrammer
Copy link
Owner

In what scenario does this happen?

There's existing logic to account for concealed text from treesitter highlights.

If this is virtual text added by other plugins then that's something I don't want to attempt to support. There's too many potential edge cases to open up this can of worms, including what about all the other places plugins could add virtual text, not just table rows. I can provide some kind of hook to let users modify the width via a function parameter, but not some generic way to handle virtual text from any source.

Issues with the logic as written:

  • hl_group == 'Conceal' doesn't cause the text to be concealed, it's just a highlight group
  • #conceal_highlight[4].virt_text[1] is not measuring text width, there are always 2 entries for each section of virtual text, should iterate over them and add the width of the first element
  • does not account for different conceal level values changing width

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