justinmk / vim-sneak

The missing motion for Vim :athletic_shoe:
http://www.vim.org/scripts/script.php?script_id=4809
MIT License
3.24k stars 88 forks source link

Hidden bug in sneak#util#skipfold #274

Closed ggandor closed 3 years ago

ggandor commented 3 years ago

The line

call cursor(foldend + 1, 1)

has been replaced by

call line(foldedge)
call col(a:reverse ? 1 : '$')

in this commit.

This is obviously nonsense - in the end, skipfold never actually moves the cursor when it says so. The reason no one has caught this so far is that wherever we use the function, we continue the search loops in this case (on return value 1), go on finding the next match, so if the fold is contained by the window area, we will eventually reach a target outside the fold anyway, if there is one (by doing some unnecessary work).