nvim-lualine / lualine.nvim

A blazing fast and easy to configure neovim statusline plugin written in pure lua.
MIT License
5.93k stars 462 forks source link

Bug: Interferes with vim-surround in LaTeX #994

Open zeertzjq opened 1 year ago

zeertzjq commented 1 year ago

Self Checks

How to reproduce the problem

Run the following shell commands:

git clone https://github.com/tpope/vim-surround.git
git clone https://github.com/nvim-lualine/lualine.nvim.git
nvim --clean tmp.tex -u <(tee <<EOF
  setlocal shiftwidth=2 expandtab
  set rtp+=$PWD/vim-surround,$PWD/lualine.nvim
  lua require('lualine').setup()
  call nvim_input('i<Space><Space><C-S><C-S><Bslash>itemize<CR>')
EOF)

Expected behaviour

Buffer content is

  \begin{itemize}

  \end{itemize}

Actual behaviour

Buffer content is

 \begin{itemize}

  \end{itemize} 

Note that there is a trailing space on the last line.

Minimal config to reproduce the issue

call plug#begin("/tmp/surround/.local/share/nvim/plugged")
Plug 'tpope/vim-surround'
Plug 'nvim-lualine/lualine.nvim'

call plug#end()

setlocal shiftwidth=2 expandtab

lua << END
require'lualine'.setup {}
END

Additional information

zeertzjq commented 1 year ago

This seems to fix the problem:

diff --git a/lua/lualine.lua b/lua/lualine.lua
index 49e38a1..d34e79f 100644
--- a/lua/lualine.lua
+++ b/lua/lualine.lua
@@ -342,7 +342,6 @@ local function refresh(opts)
   --   https://github.com/nvim-lualine/lualine.nvim/issues/791
   if
     opts.trigger == 'autocmd'
-    and vim.v.event.new_mode ~= 'c'
     -- scheduling in op-pending mode seems to call the callback forever.
     -- so this is restricted in op-pending mode.
     -- https://github.com/neovim/neovim/issues/22263
shadmansaleh commented 1 year ago

It looks like that line was added as mitigation to many bugs occurring because of updating option value in auto command context. I think those bugs still exist though I haven't checked in a while. I don't think we can remove that line right now.