debugloop / telescope-undo.nvim

A telescope extension to view and search your undo tree 🌴
MIT License
635 stars 11 forks source link

u_undo: line numbers wrong #43

Closed serranomorante closed 9 months ago

serranomorante commented 10 months ago

Sorry in advance because I really don't know how to replicate this on a new file.

This is hapenning on a specific file in one of my projects. Once I do require("telescope").extensions.undo.undo() it fails with "u_undo: line numbers wrong" and (very important, I think) my buffer loses a ton of code out of nowhere right after executing that.

Again, telescope-undo.nvim works on any other file except for this one.

Here's the error log.

1 / 2: Checking for worktree /home/serranomorante/work/.../gems/GEMS-0001
2 / 2: Running post switch callbacks
E5108: Error executing lua: vim/_editor.lua:0: nvim_exec2(): Vim(undo):E438: u_undo: line numbers wrong
stack traceback:
        [C]: in function 'nvim_exec2'
        vim/_editor.lua: in function 'cmd'
        ...vim/lazy/telescope-undo.nvim/lua/telescope-undo/init.lua:17: in function '_traverse_undotree'
        ...vim/lazy/telescope-undo.nvim/lua/telescope-undo/init.lua:100: in function '_traverse_undotree'
        ...vim/lazy/telescope-undo.nvim/lua/telescope-undo/init.lua:119: in function 'build_undolist'
        ...vim/lazy/telescope-undo.nvim/lua/telescope-undo/init.lua:141: in function 'undo'
        ...y/telescope-undo.nvim/lua/telescope/_extensions/undo.lua:41: in function 'undo'
        ...te/.config/nvim/lua/serranomorante/plugins/telescope.lua:206: in function <...te/.config/nvim/lua/serranomorante/plugins/telescope.lua:206>
Press ENTER or type command to continue
debugloop commented 9 months ago

I'm 99% sure this points to an error in your undofile. Not sure how this happens, but you should delete that file and see if it helps.

I'm however 100% sure it's not an issue of telescope-undo: The error occurs during a vim builtin which you can verify yourself. Just note the broken undostate's number and run :undo $number and observe the same error.