filestyle icon indicating copy to clipboard operation
filestyle copied to clipboard

[BUG]: Error E315 if 'splitbelow' option is set.

Open VanLaser opened this issue 9 years ago • 12 comments

When using the splitbelow option, I get strange Vim internal errors (E315), for each line, when opening a help topic.

How to reproduce (minimal vimrc - I use vim-plug as plugin manager):

set nocompatible

filetype off
call plug#begin('~/.vim/plugged')
    Plug 'aserebryakov/filestyle'
call plug#end()

filetype plugin indent on
syntax on

set splitbelow

The errors look like:

:h syntax.txt
E315: ml_get: invalid lnum: 5319
E315: ml_get: invalid lnum: 5318
...
E315: ml_get: invalid lnum: 1

I suspect the wincmd w commands are to blame, but I don't know how to change them.

Thanks for the plugin!

VanLaser avatar Jun 05 '15 10:06 VanLaser

How critical issue is?

aserebryakov avatar Jun 07 '15 05:06 aserebryakov

The issue is confirmed (Vim 7.4 for Windows + Pathogen).

aserebryakov avatar Jun 07 '15 11:06 aserebryakov

How critical issue is?

It's not critical, in that I can disable set splitbelow. It is critical, if you consider that set splitbelow is a standard Vim option that anyone should be able to use. In any case, thanks for confirming the issue.

Perhaps - just give an option not to hook/autocmd FileStyle... operations to any buffer by default, and allow/advice users how to do it selectively instead (only for their preferred filetypes)? Hooking to VimEnter etc. by default is a little intrusive. Or: avoid 'help', unlisted, or even all read-only buffers, if that's the only place where the bug appears? (just suggestions, if useful)

VanLaser avatar Jun 07 '15 15:06 VanLaser

I tried to reproduce the issue on Ubuntu version. It gives another error:

E434: Can't find tag pattern

aserebryakov avatar Jun 08 '15 17:06 aserebryakov

I can make it happen (E315) on both Win7 x64 and ArchLinux (Vim 7.4, included patches 1-729).

VanLaser avatar Jun 08 '15 18:06 VanLaser

I have the same problem and it's actually quite annoying. Similar to VanLaser, I'm also on Arch and use vim-plug. Another observation here is, that Local Additions in the help root file is empty now. Is there anything I can do to further help / debug this issue?

dennis-hamester avatar Jun 09 '15 16:06 dennis-hamester

In general, errors like E315 may mean bug in Vim itself, but anyway I will try to find workaround as soon as possible.

aserebryakov avatar Jun 09 '15 19:06 aserebryakov

@VanLaser, @dennishamester , can you please provide me the .vim and .vimrc to reproduce the issue in your environment?

aserebryakov avatar Jun 11 '15 07:06 aserebryakov

~~@VanLaser, @dennishamester, can you please check the following workaround:~~

~~Comment the wincmd w in the FileStyleDeactivate() function.~~

~~It looks like it fixes the issue in Windows.~~

aserebryakov avatar Jun 12 '15 15:06 aserebryakov

Commenting wincmd w in FileStyleDeactivate() totally breaks NerdTree.

aserebryakov avatar Jun 12 '15 16:06 aserebryakov

After a quick test, it seems to work like this:

if !&splitbelow
    wincmd w
endif

(if I comment wincmd w unconditionally, I get the original error when option splitbelow is NOT set.

An alternative way (safer?) could be, perhaps, to save the splitbelow option value, unset it temporarily, run wincmd w, then set it back to the saved value, all those in a wrapper function, instead of the simple wincmd w command. Not tested, though, it may be too late to unset the option at that point.

VanLaser avatar Jun 12 '15 16:06 VanLaser

@VanLaser, as I mentioned before it can break NERDTree.

aserebryakov avatar Jun 12 '15 17:06 aserebryakov