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

folding question

Expand Messages
  • Alexey Marinichev
    Hello, I want to have fancy folding for braces. Basically, if there is no meaningful information in the line with brace, I want it to be included in the fold,
    Message 1 of 1 , Apr 1, 2002
    • 0 Attachment
      Hello,

      I want to have fancy folding for braces. Basically, if there is no
      meaningful information in the line with brace, I want it to be included
      in the fold, and if there is (like "if (something) {" or "} else {") I
      want it to be excluded.

      I came up with a syntax region rule that seems to work for most cases,
      and there is one problem I cannot resolve. Consider the following rule:

      syn region fff start='{' end='\_$\(\n\s*}\)\@=' transparent fold

      The end is supposed to match a line preceding a line with a closing
      brace.

      It works fine, but it fails if a line preceding a line with closing
      brace is empty. That is, this works:

      - {
      | one
      |- {
      || two
      || three
      | }
      | four
      |- {
      || five
      || six
      | }
      | seven
      }

      If I make line with "three" blank, I get wront result:

      - {
      | one
      |- {
      || two
      |
      }
      four
      - {
      | five
      | six
      }
      seven
      }

      Why is it not working?

      Thanks,

      --Lyosha
    Your message has been successfully submitted and would be delivered to recipients shortly.