stefandtw / quickfix-reflector.vim

Change code right in the quickfix window
MIT License
347 stars 18 forks source link

"Cannot close last tab page" error when modifying currently open file #7

Closed idbrii closed 9 years ago

idbrii commented 9 years ago

I get an error when I have one of the files open that are modified in the quickfix. Perhaps it's possible to silence the error (since it seems to have no negative effect) or check for closing a tab not opened by quickfix-reflector?

Example file based on Visual Studio C++ output format (save as C:/temp/c.out)

------ Skipped Build: Project: shaders_pc, Configuration: Release x64 ------
Project not selected to build for this solution configuration 
file1.cpp
file2.cpp
file3.cpp
file4.cpp
C:/temp/c.txt(1): some text here

and c.txt:

some text here

On Windows Vim 7.4 and 46cc2441cca39474a37f354d17f01193528c4b7a, I use these commands:

:split /temp/c.txt
:compiler msvc
:cgetfile /temp/c.out
:copen

And then change "some" to "more" and :w and I get errors:

1 substitution on 1 line
"c.txt" [unix] 1L, 15C [w]
Error detected while processing function <SNR>97_OnWrite..<SNR>97_Replace:
line   21:
E784: Cannot close last tab page
stefandtw commented 9 years ago

I'm guessing you got this because the 'switchbuf' option was set.

Internally, a new tab is always opened for replacements and closed afterwards.

execute 'tab sbuffer ' . change.qfEntry.bufnr
...
tabclose

If the new tab failed to open because 'switchbuf' was set, that would explain the error. Should be fixed now.

idbrii commented 9 years ago

You're right I have switchbuf=useopen and 3958eff fixes that problem.

While looking at it, I noticed something else that seems unrelated but with similar steps. I filed a separate bug.