norcalli / nvim-colorizer.lua

The fastest Neovim colorizer.
Other
2.23k stars 117 forks source link

Bug: undo after moving text causes problems #92

Open amarakon opened 1 year ago

amarakon commented 1 year ago

If you delete or move text that was affected by colorizer and then undo, the colorizer will be where the cursor was before the undo instead of where it originally was before undoing.

Here are two reproducible examples:

  1. Indent (>>) and then undo (u). You will see that the colorization is one indentation level further than it should be. (See #71.)
  2. Cut (dd) and then undo (u). You will see that the colorization is one line lower than it should be.

An easy fix is to reload colorizer after every undo. I came up with this neat workaround:

vim.keymap.set("n", "u", "<CMD>undo | ColorizerReloadAllBuffers<CR>")

However, this is a workaround and not a solution.

Operating System: Gentoo GNU/Linux\ Neovim Version: 0.7.2\ Colorizer Version: 36c610a9717cc9ec426a07c8e6bf3b3abcb139d6

coffebar commented 1 year ago

When colorized text is moved to another line, color moves somewhere. I go to insert mode, then press and get messed up colors:

image

UPD: this fork has fixed this bug