Skip to content

nvim_buf_call() causes rendering artifacts with :redrawstatusline #16872

Closed
@dmitmel

Description

@dmitmel

Neovim version (nvim -v)

0.6.1

Vim (not Nvim) behaves the same?

N/A

Operating system/version

Arch Linux

Terminal name/version

kitty 0.23.1

$TERM environment variable

xterm-kitty

Installation

pacman, official repositories

How to reproduce the issue

  1. The minimal vimrc:

    set runtimepath^=~/.config/nvim/plugged/nvim-lspconfig
    
    " I chose sumneko/lua-language-server because it publishes empty lists of
    " diagnostics for all files in the workspace upon completing indexing of the
    " project, so it makes the problem more apparent.
    lua require('lspconfig')['sumneko_lua'].setup({})
    
    set title
    
    " A sufficiently complex statusline to show the screen rendering glitches.
    set runtimepath^=~/.config/nvim/plugged/vim-airline
    let g:airline#extensions#tabline#enabled = 1
    let g:airline#extensions#nvimlsp#enabled = 1
    
    " I have this in my vimrc to update the counters in the statusline.
    autocmd DiagnosticChanged * redrawstatus
    
    " This is unrelated to the bug, it is simply done to ease the wait for the
    " workspace to be fully indexed.
    autocmd User LspProgressUpdate echo v:lua.vim.lsp.util.get_progress_messages()
  2. Inside the neovim work tree, run nvim -u minimal_init.vim runtime/lua/vim/lsp/buf.lua runtime/lua/vim/lsp/*.lua. Strictly speaking, opening multiple files like this is not a requirement, but it just shows more rendering artifacts with the statusline. The buf.lua file is first in the list because there are some diagnostics reported for it, and they will be shown in the statusline.

Expected behavior

Neovim v0.6.0

simplescreenrecorder-2022-01-01_18.58.42.mp4

Actual behavior

Neovim v0.6.1 (the pink flashing box is caused by redrawstatus)

simplescreenrecorder-2022-01-01_18.59.44.mp4

Additional context

The problem is caused by #16474 and #16589. I believe that a proper solution would be to execute the autocommands with Vim's internal functions (apply_autocmds_group?), that only change the effective buffer (<abuf>) instead of also changing the real current buffer.

Metadata

Metadata

Assignees

No one assigned

    Labels

    apilibnvim, Nvim RPC APIbugissues reporting wrong behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions