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

Hunks not gets reload after pressing ]c (only with vim-css-color plugin installed) #558

Closed
UnkwUsr opened this issue May 4, 2022 · 4 comments
Labels
bug Something isn't working upstream issue Issue/limitation of Neovim core
Milestone

Comments

@UnkwUsr
Copy link

UnkwUsr commented May 4, 2022

Description

Hunks gets reload only on movements like j and k (maybe some more), which results in behavior that when I open file and press ]c, I get my cursor navigated to first hunk in file, but it is not yet highlighted. And to highlight I must press j or k at least once.

Also with bisecting I found that this behavior started on 7de9533, so latest commit with "expected behavior" was 5c487a8.

And also plugin ap/vim-css-color is required to reproduce this issue.

Neovim version

v0.7.0

Operating system and version

archlinux

Expected behavior

Hunks should be highlighted just after pressing ]c.

good.mp4

Actual behavior

Hunks is not highlighted after ]c and I should press j or k to get it highlighted.

bad.mp4

Minimal config

vim.o.packpath = '/tmp/nvim/site'

local plugins = {
  gitsigns = 'https://github.com/lewis6991/gitsigns.nvim',
  -- ADD OTHER PLUGINS _NECESSARY_ TO REPRODUCE THE ISSUE

  csscolors = 'https://github.com/ap/vim-css-color'
}

for name, url in pairs(plugins) do
  local install_path = '/tmp/nvim/site/pack/test/start/'..name
  if vim.fn.isdirectory(install_path) == 0 then
    vim.fn.system { 'git', 'clone', '--depth=1', url, install_path }
  end
end

require('gitsigns').setup{
  debug_mode = true, -- You must add this to enable debug messages
  -- ADD GITSIGNS CONFIG THAT IS _NECESSARY_ FOR REPRODUCING THE ISSUE

  on_attach = function(bufnr)
    vim.api.nvim_buf_set_keymap(bufnr, 'n', ']c',  "&diff ? ']c' : '<cmd>Gitsigns next_hunk<CR>'", {expr=true})
  end
}

-- ADD INIT.LUA SETTINGS THAT IS _NECESSARY_ FOR REPRODUCING THE ISSUE

Steps to reproduce

  1. nvim --clean -u minimal.lua somefile
  2. Press ]c
  3. See your cursor on hunk, but it is not highlighted.

Gitsigns debug messages

No response

@UnkwUsr UnkwUsr added the bug Something isn't working label May 4, 2022
@lewis6991
Copy link
Owner

I can't debug this without being able to reproduce the issue and the information provided isn't sufficient.

Can you provide a tar of a minimised git repo with a file that produces the issue?

@UnkwUsr
Copy link
Author

UnkwUsr commented May 4, 2022

test_repo.tar.gz

@lewis6991 lewis6991 added this to the v0.5 milestone May 12, 2022
@lewis6991
Copy link
Owner

Thanks for the test_repo. I am able to reproduce the issue.

@lewis6991
Copy link
Owner

lewis6991 commented May 20, 2022

Debugged.

This is an issue with Neovim. Here is a reduced testcase that uses no plugins:

-- Fill the buffer with some text
local lines = {}
for i = 1, 200 do
  lines[i] = 'hello'
end
vim.api.nvim_buf_set_lines(0, 0, -1, false, lines)

-- Set up a basic decoration provide which sets a sign on line 100
local ns = vim.api.nvim_create_namespace('ns')
vim.api.nvim_set_decoration_provider(ns, {
  on_win = function(_, _, bufnr, top, bot)
    if top < 100 and bot > 100 then
      vim.api.nvim_buf_set_extmark(bufnr, ns, 99, -1, { sign_text = 'X' })
    end
  end
})

-- Autocmd command which shows the bug
vim.api.nvim_create_autocmd('CursorMoved', {
  callback = function()
    vim.fn.line('w$')  -- Prevents on_win from being called
  end
})

-- Move the cursor sometime after loading the buffer
vim.o.updatetime = 200
vim.api.nvim_create_autocmd('CursorHold', {
  once = true,
  callback = function()
    vim.api.nvim_win_set_cursor(0, {100,0})
  end
})
nvim --clean -u min.lua

Raised neovim/neovim#18661

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working upstream issue Issue/limitation of Neovim core
Projects
None yet
Development

No branches or pull requests

2 participants