Monday, June 9, 2014

Re: How can a highlight group combine custom attributes and a link?

Mark Lodato wrote:

[...]

> I am the user who is having the issues and I think I have discovered
> the underlying bug. As mentioned above, `:hi [default] link From To`
> should only do the link if From has no settings, and if default is
> omitted, should issue the error "E414: group has settings, highlight
> link ignored". In fact, at least on Ubuntu 14.04 package vim-gtk
> 7.4.052-1ubuntu3, this only happens if From has no *terminal*
> settings, unless you are running the command from gvim once it has
> started. If From has only gui settings and either running console vim
> is used or the commands are found in the startup files, the `:hi link
> From To` acts as though From has no settings and performs the link
> anyway.
>
> Here is a simple example:
>
> $ vim -u NONE
> :hi Foo guifg=blue
> :hi link Foo Error
>
> The above should error out but it does not. Here is a full example to
> show that this happens on both vim and gvim:
>
> $ mv .vim vim-bak
> $ mv .vimrc vimrc-bak
> $ cat >.vimrc <<EOF
> hi GuiTest guifg=blue
> hi CtermTest ctermfg=blue
> hi GuiTest
> hi CtermTest
> hi default link GuiTest Error
> hi default link CtermTest Error
> hi GuiTest
> hi CtermTest
> EOF
> $ gvim # or vim
>
> This gives the following result:
>
> GuiTest xxx guifg=blue
> CtermTest xxx ctermfg=12
> GuiTest xxx guifg=blue
> links to Error
> CtermTest xxx ctermfg=12
>
> The expected result is that neither GuiTest nor CtermTest link to Error.
>
> Note, however, that if you try to run those same commands once the gui
> has started, you get the expected error message. But this only works
> in gvim; regular vim exhibits the same bug as putting it in the vimrc
> file.

Yes, it appears the "if settings already exist" only checks for term
settings, not gui settings. This is inconsistant. I suppose we can
change that without causing trouble for existing setups.

--
There is a fine line between courage and foolishness.
Unfortunately, it's not a fence.

/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

--
--
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: