Thursday, December 31, 2015

Re: When is an xterm's t_Co detected?

Gary Johnson wrote:

> I recently learned that Vim can query an xterm directly for the
> number of colors it supports. (This is not necessarily the same
> value reported by terminfo. Otherwise, it wouldn't be very useful.)
> Vim then sets t_Co to this number. I would like to use that value
> to affect other color settings, but I can't figure out when to do
> that. I captured the value of &t_Co at the start and end of my
> ~/.vimrc and upon these autocommand events,
>
> BufWinEnter
> ColorScheme
> FileType
> OptionSet
> TermResponse
> VimEnter
>
> but the value was always 8. By the time I queried the value from
> Vim's command line, though, the value was 256.
>
> What event do I need to wait for to determine that t_Co may have
> changed to 256?

Can't think of something. We do have the OptionSet autocommand event,
but it's not triggered in this case. Perhaps we should make a change
for that. The code is near the end of set_num_option().

--
LAUNCELOT: I am, sir. I am a Knight of King Arthur.
FATHER: 'Mm ... very nice castle, Camelot ... very good pig country....
"Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

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