Wednesday, February 3, 2016

Re: Puzzling behavior of AnsiEsc! in an autocommand

Hi Gary!

On Mi, 03 Feb 2016, Gary Johnson wrote:

> Thanks for looking into this. With your results as a guide, I
> reduced the environment needed to reproduce the issue even further.
> Now the vim command is simply this,
>
> $ vim -N -u NONE -o2 --cmd 'so colorschemetest.vim' --cmd 'au ColorScheme * call CSTest()'
>
> where colorschemetest.vim contains this function:
>
> fun CSTest()
> hi clear
> endfun
>
> Executing ":colorscheme default" causes all highlighting to be
> cleared, not restored to the defaults.
>
> The issue seems to occur only when ":hi clear" is contained in a
> function _and_ that function is called from a ColorScheme
> autocommand.

I think this happens because colorscheme default calls
load_colors(), which sets the recursive flag to true, then the hi clear
internally causes a recursive call to load_colors(), to load the default
color scheme again, which aborts, because this is a recursive call.

We could probably reset the recursive protector variable before calling
the color scheme autocommand. But what happens, if the colorscheme
autocommand does load another color scheme?

Best,
Christian
--
Verunglimpfungen sind für den, der sie ausspricht, schimpflicher als
für den, dem sie gelten.
-- Plutarch (45-125 n.Chr.)

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment