Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Neovim: Error with undo without EOL #5

Open
AlexMasterov opened this issue Feb 10, 2020 · 2 comments
Open

Neovim: Error with undo without EOL #5

AlexMasterov opened this issue Feb 10, 2020 · 2 comments

Comments

@AlexMasterov
Copy link

AlexMasterov commented Feb 10, 2020

Hello 😃
I get the error:

Error executing lua callback: [string ":lua"]:1: Vim(call):E16: Invalid range: call s:RemoveRange(a:start, a:end - 1)

How to reproduce:

function! ReverseLines() range
  let lines = reverse(getline(a:firstline, a:lastline))
  silent execute a:firstline . ',' . a:lastline . 'delete _'
  silent execute (a:firstline - 1) . 'put =lines'
endfunction

command! -bar -range=% Reproduce <line1>,<line2> call ReverseLines()
  1. Use the Reproduce command on the two selected lines with 0 and 1
  2. Press undo by u

no-error


0
1

error


0
1

NVIM v0.5.0-360-g1f479fffb

VIM 8.2 (p236) — works fine

@axelf4
Copy link
Owner

axelf4 commented Feb 10, 2020

Thanks again, this is definitely in the same vein as #4. The offending line is here. Will try fixing, if I get the time to do so.

I have thought about a workaround but don't think there's a surefire way: You have to make the line number be valid for calling Vim script functions not to error, but there's no way to restore the invalid line number that the calling code might be expecting (and so the cursor would move).

@mellery451
Copy link

I also hit this error when using vimspector

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants