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

Re: Possible bug on highlighting matching

Expand Messages
  • Andy Wokula
    ... It is. It doesn t mean that overlapping is not possible at all. The search for another match can either start after the end of the current match (with
    Message 1 of 7 , Sep 28, 2008
    • 0 Attachment
      Sandro Bosio schrieb:
      > Consider the following text:
      >
      > sample example
      >
      > The following searches highlight both the "a" :
      >
      > /^s\zsa\zemple\|ex\zsa\zemple
      > /^s\zsa\zemple\| ex\zsa\zemple
      > /^s\zsa\zemple\|e ex\zsa\zemple
      > /^s\zsa\zemple\|le ex\zsa\zemple
      > /^s\zsa\zemple\|mple ex\zsa\zemple
      >
      > The following do highlight only the first:
      >
      > /^s\zsa\zemple\|ample ex\zsa\zemple
      > /^s\zsa\zemple\|sample ex\zsa\zemple
      > /^s\zsa\zemple\|^\p*ex\zsa\zemple
      >
      > In other words, when the second match overlaps with the first, the
      > second one is not highlighted, even if it actually matches. Is this
      > correct behaviour?

      It is. It doesn't mean that overlapping is not possible at all.

      The search for another match can either start after the end of the
      current match (with cpo+=c, default) or after the cursor position
      (cpo-=c). If a '\ze' matches, the end of match will be there. The
      search cannot start at the cursor position or even more to the left of
      it. :h cpo-c

      sample example

      /^s\zsample\|mple ex\zsa\zemple

      As a workaround, you can check if a match can be made, without actually
      matching:
      :h /\@=
      :h /\@<=
      and so on.

      --
      Andy


      --~--~---------~--~----~------------~-------~--~----~
      You received this message from the "vim_use" maillist.
      For more information, visit http://www.vim.org/maillist.php
      -~----------~----~----~----~------~----~------~--~---
    Your message has been successfully submitted and would be delivered to recipients shortly.