chrisbra / NrrwRgn

A Narrow Region Plugin for vim (like Emacs Narrow Region)
http://www.vim.org/scripts/script.php?script_id=3075
674 stars 25 forks source link

WidenRegion fails when used from NR! #73

Open idbrii opened 5 years ago

idbrii commented 5 years ago

WidenRegion fails when used from NR!

Repro

Using NrrRgn db03db92d2ce8f3c4a4e592c6f13f70eb0c98ac3 (originally encountered on 19e79fb4346369dfa3a4e6fd35742f5c5d40bdba, but I'm not sure this ever worked for me).

VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Nov 24 2016 16:43

In ~/.vim/bundle: pathogen, sensible, NrrRgn

vimrc:

runtime bundle/pathogen/autoload/pathogen.vim
call pathogen#infect()
edit NrrRgn/todo.txt
normal! v4ip
NR!
WidenRegion!

Results in this error:

Error detected while processing function nrrwrgn#WidenRegion:
line  194:
E86: Buffer 2 does not exist

Also seen on (albeit not with a clean vimrc): VIM - Vi IMproved 8.1 (2018 May 18, compiled Mar 28 2019 23:01:56) MS-Windows 64-bit GUI version with OLE support Included patches: 1-1066

Error has more context:

Error detected while processing function
nrrwrgn#WidenRegion[194]
E86: Buffer 29 does not exist

If the NR! buffer is modified, I get a "E37: No write since last change" error.

I also noticed that echo nrrwrgn#NrrwRgnStatus() returns {} from the NR! buffer which seems incorrect.

Using :NR without the bang does not have these problems, but doesn't let me edit in a large window.

idbrii commented 5 years ago

While repro'ing, I also saw this error that I don't understand:

Error detected while processing function
nrrwrgn#WidenRegion[200]
<SNR>375_JumpToBufinTab[6]
<SNR>375_GoToWindow[12]
E16: Invalid range: :noau 23b

How does it interpret :23b as a range? (Unless vim sometimes confuses counts and ranges?)