Loading ...
Sorry, an error occurred while loading the content.

Re: BUG -- Too many highlight groups causes unpredectiable colors

Expand Messages
  • GI
    ... I meant to say vim 6.3.29 naturally. GI -- Impotence is just Nature s way of saying No hard feelings
    Message 1 of 4 , Oct 6, 2004
    • 0 Attachment
      On Wed, Oct 06, 2004 at 10:28:14AM -0500, GI wrote:

      > I found that when I have about 200 odd different highlight groups, the
      > last few are unpredictable. Try the following script for example --
      >
      >
      > let s:hex='0123456789abcdef'
      >
      > function! s:tohex(n)
      > return strpart( s:hex, a:n/16, 1) . strpart( s:hex, a:n%16, 1)
      > endfunction
      >
      > let i = 0
      > while i < 256
      > exec 'hi color'.i 'guifg=#'.s:tohex(i).s:tohex(i).'00'
      > exec 'syn keyword color'.i 'color'.i
      > let i = i + 1
      > endwhile
      >
      > When I load gvim (with gvim -u NONE -N) and source the above script, I
      > find that the colors around 200 and above are not what they should be.
      > (Check by typing :hi and scroling down, or adding a line with 'color1
      > color2 ... color255' to your file). It should be a increasing intensity
      > yellow shade. However the 200 odd and up colors show up as reverse video
      > / underlined / random colors.
      >
      > Does anyone else find the same problem. I found it on Vim 6.6.29 on
      > Linux (Redhat 9, Fedora & Gentoo).

      I meant to say vim 6.3.29 naturally.

      GI

      --
      Impotence is just Nature's way of saying "No hard feelings"
    • Bram Moolenaar
      ... It s right that you can have only about 200 different extra colors. That is because only one byte is used to store the attributes of a character. You
      Message 2 of 4 , Oct 6, 2004
      • 0 Attachment
        Gautam wrote:

        > I found that when I have about 200 odd different highlight groups, the
        > last few are unpredictable. Try the following script for example --
        >
        >
        > let s:hex='0123456789abcdef'
        >
        > function! s:tohex(n)
        > return strpart( s:hex, a:n/16, 1) . strpart( s:hex, a:n%16, 1)
        > endfunction
        >
        > let i = 0
        > while i < 256
        > exec 'hi color'.i 'guifg=#'.s:tohex(i).s:tohex(i).'00'
        > exec 'syn keyword color'.i 'color'.i
        > let i = i + 1
        > endwhile
        >
        > When I load gvim (with gvim -u NONE -N) and source the above script, I
        > find that the colors around 200 and above are not what they should be.
        > (Check by typing :hi and scroling down, or adding a line with 'color1
        > color2 ... color255' to your file). It should be a increasing intensity
        > yellow shade. However the 200 odd and up colors show up as reverse video
        > / underlined / random colors.

        It's right that you can have only about 200 different extra colors.
        That is because only one byte is used to store the attributes of a
        character.

        You should have gotten an error message about this though. Apparently
        the check for this wasn't working right. This patch fixes that:

        *** syntax.c~ Tue Oct 5 16:45:38 2004
        --- syntax.c Wed Oct 6 19:21:10 2004
        ***************
        *** 7396,7402 ****
        return i + ATTR_OFF;
        }

        ! if (table->ga_len + ATTR_OFF == 256)
        {
        /*
        * Running out of attribute entries! remove all attributes, and
        --- 7396,7402 ----
        return i + ATTR_OFF;
        }

        ! if (table->ga_len + ATTR_OFF >= 256)
        {
        /*
        * Running out of attribute entries! remove all attributes, and

        --
        From "know your smileys":
        % Bike accident (a bit far-fetched, I suppose)

        /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
        /// Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
        \\\ Project leader for A-A-P -- http://www.A-A-P.org ///
        \\\ Buy at Amazon and help AIDS victims -- http://ICCF.nl/click1.html ///
      • Gautam Iyer
        ... Hi Bram, Well, this patch does give me a warning message when there are too many highlighting groups. However for some reason my *current* colors get
        Message 3 of 4 , Oct 6, 2004
        • 0 Attachment
          On Wed, Oct 06, 2004 at 07:30:18PM +0200, Bram Moolenaar wrote:

          > Gautam wrote:
          >
          > > I found that when I have about 200 odd different highlight groups, the
          > > last few are unpredictable. Try the following script for example --
          > >
          > >
          > > let s:hex='0123456789abcdef'
          > >
          > > function! s:tohex(n)
          > > return strpart( s:hex, a:n/16, 1) . strpart( s:hex, a:n%16, 1)
          > > endfunction
          > >
          > > let i = 0
          > > while i < 256
          > > exec 'hi color'.i 'guifg=#'.s:tohex(i).s:tohex(i).'00'
          > > exec 'syn keyword color'.i 'color'.i
          > > let i = i + 1
          > > endwhile
          > >
          > > When I load gvim (with gvim -u NONE -N) and source the above script, I
          > > find that the colors around 200 and above are not what they should be.
          > > (Check by typing :hi and scroling down, or adding a line with 'color1
          > > color2 ... color255' to your file). It should be a increasing intensity
          > > yellow shade. However the 200 odd and up colors show up as reverse video
          > > / underlined / random colors.
          >
          > It's right that you can have only about 200 different extra colors.
          > That is because only one byte is used to store the attributes of a
          > character.
          >
          > You should have gotten an error message about this though. Apparently
          > the check for this wasn't working right. This patch fixes that:

          Hi Bram,

          Well, this patch does give me a warning message when there are too many
          highlighting groups. However for some reason my *current* colors get
          screwed up. Every time I get this warning message, I need to reload my
          color scheme!

          Gautam

          --
          'Solicitor' -- A person that makes sure they get what's coming to you.
        Your message has been successfully submitted and would be delivered to recipients shortly.