simnalamburt / vim-mundo

:christmas_tree: Vim undo tree visualizer

Home Page:https://simnalamburt.github.io/vim-mundo

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ValueError if searching for undo history which has a null character ^@

ruohola opened this issue · comments

The error occurs when you're trying to search (with /) a place in the undo history which also happens to have a ^@ aka null character in one of the changed lines. The place of the null character on the line is irrelevant, it just has to be somewhere in a + or - line.

The error is easy to reproduce:

  • Start editing a new file
  • Type the line (use CTRL-V CTRL-J, for typing the ^@): test^@
  • Exit insert mode so the changes are in different undos:
  • Make a 2nd line with the text: otherline
  • Open Mundo and /test
  • This error happens:
Error detected while processing function <SNR>54_MundoPython:
line    1:
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/Users/eero/.dotfiles/vim/plugged/vim-mundo/autoload/mundo.py", line 306, in MundoSearch
    MundoNextMatch()
  File "/Users/eero/.dotfiles/vim/plugged/vim-mundo/autoload/mundo.py", line 314, in MundoNextMatch
    MundoMatch(1)
  File "/Users/eero/.dotfiles/vim/plugged/vim-mundo/autoload/mundo.py", line 344, in MundoMatch
    match_index = vim.eval('match("%s",@/)'% change.replace("\\","\\\\").replace('"','\\"'))
ValueError: embedded null byte