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

Re: [patch] Allow 'highlight' command to add to existing terminal attributes.

Expand Messages
  • So8res
    ... Done. ... Added += and -= tests to test51. I ve split the src/ diff into a src/syntax.c diff and a src/testdir/ diff. Let me know if you prefer the
    Message 1 of 5 , Dec 2, 2012
    • 0 Attachment
      > I like the idea, but I would prefer to use += and -=, just like :set.

      Done.

      > Also, can you write a test for correct behavior?

      Added += and -= tests to test51.

      I've split the "src/" diff into a "src/syntax.c" diff and a "src/testdir/" diff. Let me know if you prefer the diffs split up differently in the future.

      > The documentation should mention what happens when trying to remove a
      >
      > value that isn't there. Is it a warning, error, or ignored?

      It's ignored. I think this is the correct behavior, it allows you to do

      highlight Unbold term-=bold

      and apply it to any syntax group without worrying about whether or not it will apply.

      Docs have been updated.

      > The error for unexpected plus sign should be put in a function instead
      >
      > of writing that code several times.

      I extracted it into a function. It's not the cleanest, because the block of code has to set the local 'error' variable and do a break. I took the route of least replication.

      --
      You received this message from the "vim_dev" 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
    • So8res
      Unfortunately, this doesn t address my StackOverflow question entirely, nor does it make it possible to avoid the workaround mentioned. This patch allows you
      Message 2 of 5 , Dec 2, 2012
      • 0 Attachment
        Unfortunately, this doesn't address my StackOverflow question entirely, nor does it make it possible to avoid the workaround mentioned.

        This patch allows you to update a single highlight group, but it does not allow you to create a modifier highlight group. In other words, if you have

        highlight Italic cterm=italic
        highlight Bold cterm+=bold

        then even if you match 'Bold' inside 'Italic' you only get the 'Bold' highlighting, not a combination of the two.

        I'd like to add a new highlight type of the form

        highlight modifier Bold cterm=bold

        which (in this example) would continue highlighting with the previous matchgroup but *add* the bold terminal attribute.

        This feature is a bit more involved than the above patch -- Bram, would you accept such a feature? I don't want to waste my efforts.

        --
        You received this message from the "vim_dev" 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
      • So8res
        Correction -- it would have to be a new syntax type, not a new highlight type. You d have syntax modifier region bold start= * end= * highlight Bold
        Message 3 of 5 , Dec 2, 2012
        • 0 Attachment
          Correction -- it would have to be a new syntax type, not a new highlight type. You'd have

          syntax modifier region bold start='\*' end='\*'
          highlight Bold cterm=bold

          This would involve modifying text to have both a base highlight group and an arbitrary number of syntax modifiers active. Thoughts?

          --
          You received this message from the "vim_dev" 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
        Your message has been successfully submitted and would be delivered to recipients shortly.