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(highlights): fix misaligned rendering in visual mode #1401

Merged
merged 12 commits into from
Aug 30, 2023

Conversation

xiyaowong
Copy link
Collaborator

@xiyaowong xiyaowong commented Aug 28, 2023

  • Resolve incorrect col_start parameter in grid_line event due to tab synchronization issue.
  • Resolve pseudo cursor rendering issue on tab.
  • Resolve undesired Cursor highlight ranges.

fixes #1374, fixes #1144, fixes #1368

Selections are already highlighted by vscode
`nvim_buf_set_name` will do filetype detection, so we must override tab options
after vim initializes defaults. If the indentation options for nvim and vscode
don't match, this can lead to misaligned rendering when tabs are present.
@theol0403
Copy link
Member

Thanks for this!!

For the visual selection highlight, I opted to include it because there are some cases where neovim does not notify vscode that the visual selection has been updated. neovim/neovim#19708. I think this just smooths the edges and makes sure you always get some feedback that the visual selection has updated, albeit where the vscode selection will be temporarily incorrect.

Does this also fix the issue I found in #1144? I was able to reproduce the issue in terminal neovim, which was that when the "fake" visual cursor is on top of a tabstop character, it doesn't render the tabstop, messing up the highlighting. You probably just don't see the problem because you disabled visual highlight.

I'm not sure about the breaking test, it could be from unrelated changes/neovim update, or there could be some edge case you've uncovered.

Thanks for looking into this!

@xiyaowong

This comment was marked as outdated.

@xiyaowong xiyaowong marked this pull request as ready for review August 29, 2023 13:26
@xiyaowong
Copy link
Collaborator Author

@theol0403 Well, it's been a long day of debugging.

@theol0403
Copy link
Member

Thanks for all the debugging!

Unfortunately, I don't think this fully solves any of the linked PRs.

I think that 0ebe821 (#1401) just hides the issues, but like I mentioned, the visual selection is still currently needed to provide visual feedback to actions like ciw.

I believe you've fixed a real bug, but I am still able to reproduce, with tabs and visual selection enabled, the issues.

@xiyaowong xiyaowong changed the title fix(highlights): fix misaligned rendering in visual mode fix(tabs): ensure tab synchronization for new buffers Aug 30, 2023
@xiyaowong

This comment was marked as outdated.

@xiyaowong
Copy link
Collaborator Author

Well, I've reproduced these issues, too. That's sad

@xiyaowong xiyaowong changed the title fix(tabs): ensure tab synchronization for new buffers fix(highlights): fix misaligned rendering in visual mode Aug 30, 2023
@xiyaowong
Copy link
Collaborator Author

@theol0403 All the issues I encountered so far have been fixed 🏃

Copy link
Member

@theol0403 theol0403 left a comment

Choose a reason for hiding this comment

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

Great work, looks awesome!

@theol0403 theol0403 merged commit 479f525 into vscode-neovim:master Aug 30, 2023
6 of 7 checks passed
@thessem
Copy link

thessem commented Aug 31, 2023

Just wanna pop in to this PR and say this has significantly increased my quality of life. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants