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] win options clobbered (winhl), not set (winblend) #515

Open
tmillr opened this issue Jun 24, 2024 · 2 comments
Open

[Bug] win options clobbered (winhl), not set (winblend) #515

tmillr opened this issue Jun 24, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@tmillr
Copy link

tmillr commented Jun 24, 2024

Description

Leaving and coming back to the diffview tab, or simply just revisiting one of the diffs (buffers), resets/clobbers all of my winhl customizations. Is there any reason why this plugin is dynamically changing/resetting options on TabLeave, or, when revisiting a previously-viewed buffer (especially given the fact that the window ids remain the same)? This is silly and unexpected behavior imo. How else can I customize winhl? Right now I'm using a DiffviewDiffBufRead autocmd (because setting win opts or config via this plugin seems to be only supported for "panels"?).

I guess in the meantime I need to choose a different autocmd, or force my highlights with a window namespace.

EDIT: it seems that other window options, like spell, are not reset/clobbered. So I assume the winhl issue is because either:

A. winhl is set by this plugin, while spell isn't
B. winhl isn't getting set/reset properly (although it probably shouldn't be reset in the first place, unless there is a good reason to do so)

Expected behavior

  • Don't reset options post-load if it is not necessary.
  • Don't clobber winhl or any other list-like options that this plugin sets (you need to share, or allow me a way to accomplish this via other means, lol).

Actual behavior

See Description

Steps to reproduce

nvim --clean
DiffviewOpen {somerev}

-- Set winhl without clobbering other mappings.
-- This could even be improved further (but I won't do that here), as hl groups are in fact case-insensitive.
local w = vim.opt_local.winhl
w.DiffChange = 'MyDiffChangeAsDiffDelete'
vim.opt_local.winhl = w

-- Now just trigger issue as explained above

Health check

Likely irrelevant, but here it is:

diffview: require("diffview.health").check()

Checking plugin dependencies ~
- OK nvim-web-devicons installed.

Checking VCS tools ~
- The plugin requires at least one of the supported VCS tools to be valid.
- OK Git found.
- OK Git is up-to-date. (2.45.1)
- WARNING Configured `hg_cmd` is not executable: 'hg'

Log info

n/a

Neovim version

0.10

Operating system and version

macOS 14.2.1

Minimal config

n/a, defaults

Maybe related to: #457, #442

@tmillr tmillr added the bug Something isn't working label Jun 24, 2024
@tmillr
Copy link
Author

tmillr commented Jun 24, 2024

Idk why (it fires on TabEnter), but I guess adding DiffviewDiffBufWinEnter to the events of my autocmd helps as a workaround.

@tmillr
Copy link
Author

tmillr commented Jul 1, 2024

This also doesn't work:

nvim --clean +"lua require('diffview').setup { commit_log_panel = { win_config = { winopts = { winblend = 10, } } } }"

@tmillr tmillr changed the title [Bug] window options get clobbered (e.g. winhl) [Bug] win options clobbered (winhl), not set (winblend) Jul 1, 2024
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

1 participant