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: conceallevel not reset when switching buffer #209

Closed
2 tasks done
paulhersch opened this issue Oct 18, 2024 · 1 comment
Closed
2 tasks done

bug: conceallevel not reset when switching buffer #209

paulhersch opened this issue Oct 18, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@paulhersch
Copy link

paulhersch commented Oct 18, 2024

Neovim version (nvim -v)

0.10.2

Neovim distribution

N/A

Operating system

Linux

Terminal emulator / GUI

foot

Describe the bug

When i switch from the rendered markdown buffer to a different buffer (i have an own UI thing that uses vim.api.nvim_win_set_bufunder the hood) the conceallevel for the window is not reset, which sucks if i switch from markdown to another filetype.

Expected behavior

Conceallevel is reset when i switch buffers.

Healthcheck output

render-markdown: require("render-markdown.health").check()
 
 render-markdown.nvim [version]
 - OK plugin 7.3.11
 - OK neovim >= 0.10
 
 render-markdown.nvim [configuration]
 - OK valid
 
 render-markdown.nvim [nvim-treesitter]
 - OK installed
 - OK markdown: parser installed
 - OK markdown: highlight enabled
 - OK markdown_inline: parser installed
 - OK markdown_inline: highlight enabled
 - OK latex: parser installed
 
 render-markdown.nvim [executables]
 - OK latex2text: installed
 
 render-markdown.nvim [conflicts]
 - OK headlines: not installed
 - OK obsidian: not installed

Plugin configuration

{
  enabled = true,
  latex = {
    enabled = false,
  },
  max_file_size = 5
}

Plugin error log

N/A

Confirmations

  • I have updated this plugin to the latest version using my plugin manager
  • I have provided the text contained in all screenshots as raw text in this issue. This means if there is a screenshot below it is the copy pasted contents of the file in the screenshot. I understand that my issue will be closed if I have not.

Additional information

No response

@paulhersch paulhersch added the bug Something isn't working label Oct 18, 2024
MeanderingProgrammer added a commit that referenced this issue Oct 19, 2024
## Details

Issue: #209

Currently when a user leaves a buffer we render the buffer.

This works as expected when a user is say switching between multiple windows.

However if a user re-uses the current window for another buffer it will
have the window options applied as if it is rendered markdown, i.e. a
conceallevel of 3, which is unepected. This can also occur if a plugin
opens a buffer in the window via the `nvim_win_set_buf` API.

This occurs because at the time the update is triggered the buffer and
window are associated with each other, however due to the use of
vim.schedule when the update occurs this may not longer be the case.

To fix this add a check that the buffer is the one associated with the
window being updated. Include this in the `util.valid` logic so it will
be used at the time the update is triggered and at the time it is
actually ran.

Other minor changes:

- Remove `buf` field from `BufferState`
- Updated window related utility functions
- Remove wrapper functions where they are not needed, i.e. all the
  renderers will work out of the box no need to add one in each module
@MeanderingProgrammer
Copy link
Owner

Thanks for letting me know, turns out this was effecting some other things as well, like oil.nvim buffers.

Should be fixed with: c6b59a2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants