Wednesday, February 3, 2016

Re: Puzzling behavior of AnsiEsc! in an autocommand

Hi Christian,

On 2016-02-03, Christian Brabandt wrote:
> Hi Gary!
>
> On Di, 02 Feb 2016, Gary Johnson wrote:
>
> > I'm running Vim 7.4.1152 in an xterm on a Red Hat Enterprise Linux
> > 7.1 system and using Dr. Chip's AnsiEsc plugin (v13i) to make ANSI
> > color escape sequences in some files readable.
> >
> > I noticed some odd behavior and simplified the conditions down to
> > this (one line).
> >
> > $ vim -N -u NONE -o2 --cmd 'so plugin/cecutil.vim' --cmd 'so plugin/AnsiEscPlugin.vim' --cmd 'au BufWinEnter * AnsiEsc' --cmd 'au ColorScheme * AnsiEsc!'
> >
> > I used "-o2" to make the current-window and not-current-window
> > status lines visible.
> >
> > The initial appearance of the screen is as expected: the status
> > lines are in inverse video with "[No Name]" on the left and no other
> > characters in them, and the empty buffer lines are indicated by a
> > blue tilde in the first column. Now execute
> >
> > :colorscheme default
> >
> > (The name of the color scheme doesn't seem to matter.) All
> > highlighting disappears: the status lines and the tildes are white
> > on black. In addition, the "empty" space on the current-window
> > status line is filled with carats (^) and the space on the
> > not-current-window is filled with equal signs (=). The screen looks
> > like this (with redundant lines and columns removed for clarity):
> >
> > ~
> > ~
> > ~
> > ~
> > [No Name]^^^^^^^^^^^^^^^^^^^^
> > ~
> > ~
> > ~
> > ~
> > [No Name]====================
> >
> > Executing ":hi" shows almost all the highlights have been cleared,
> > e.g.,
> >
> > SpecialKey xxx cleared
> >
> > The corruption of the highlighting occurs when "AnsiEsc!" is
> > executed by the ColorScheme event. If I remove that autocommand and
> > execute ":AnsiEsc" from the command line, nothing odd happens.
> >
> > I don't know whether this is a bug in the AnsiEsc plugin or in the
> > processing of the ColorScheme autocommand event, or perhaps in some
> > command the AnsiEsc plugin is executing, so I thought I'd post this
> > here rather than send it just to Dr. Chip.
>
> IIRC, this is a feature of Vim, to prevent an empty statusline. E.g.
> this is done on purpose, when fillchars does not contain an entry stl:x
> or stlnc:x and the 'statusline' option is not empty and the default
> highlighting group for Statusline or StatuslineNC is reset

I thought maybe that part had to do with 'fillchars', but I was
confused by the documentation. ":help 'fillchars'" says that for
the not-current-statusline, stlnc:c is ' ' or '-' and I'm observing
'='. The documentation should be fixed.

Looking around ":help syntax.txt", I don't see a single command that
will cause all highlighting to disappear. It looks like each group
has to be reset with ":hi <group> NONE" or ":hi clear <group>".

Executing

:hi clear StatusLine
:hi clear StatusLineNC

verifies that those make the status lines appear as they do.

A quick search through ~/.vim/autoload/AnsiEsc.vim for "clear" or
"NONE", though, doesn't reveal any obvious (to me) places where
almost all highlight groups would be reset.

Regards,
Gary

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