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

Bug: Extmarks cleared in one split when a help file is splitted and scrolled #15

Open
Bekaboo opened this issue Sep 25, 2024 · 4 comments

Comments

@Bekaboo
Copy link

Bekaboo commented Sep 25, 2024

When a help file is splitted into two windows and one of the window scrolls, the visual effects can be cleared in another window, expect both windows render normally.

I believe this is because helpview clears "off-screen" extmarks but it only considers visible range of the current window instead of all windows that contain the help file.

2024-09-25.10-48-57.mp4
@OXY2DEV
Copy link
Owner

OXY2DEV commented Sep 25, 2024

There's a few issues here,

  1. There's no clean way to get all the attached windows so the plugin doesn't work well when you have multiple windows with a single buffer.
  2. If the plugin were to render based on all the cursor you would get copies of extmark when their range overlaps which is a problem.

At the moment it's not possible to handle multiple windows. But maybe in the future this can be added.

@Bekaboo
Copy link
Author

Bekaboo commented Sep 25, 2024

How about just not to clear off screen extmarks as a workaround?

@OXY2DEV
Copy link
Owner

OXY2DEV commented Sep 25, 2024

That leaves different kinds of edge cases.

If you have something like this in a help file.

>lua
  vim.print("something");
<

If any of the line is within the range of the renderer the entire thing will be rendered.


Let's say, you open the file and started at the bottom of the file and the last line of the code block was in the range.

Then you did gg, this time you went to the top of the file and only the first line of the code block was in the range.

Now, you permanently have 2 extmarks that won't go away unless you manually scroll over them.

This becomes an issue with headings.

Plus some lines in the help file contain a lot of inline elements. They would be duplicated.

And the modeline will also have a lot of duplicate lines.

@Bekaboo
Copy link
Author

Bekaboo commented Sep 25, 2024

I see.

There's no clean way to get all the attached windows so the plugin doesn't work well when you have multiple windows with a single buffer.

FYI vim.fn.win_findbuf(bufnr) returns a list of windows that contains the given buffer. I think it's quite clean.

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

No branches or pull requests

2 participants