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

Re: [patch] fix problem with syntax-based folding

Expand Messages
  • Bram Moolenaar
    ... Thanks, I ll look into it soon. -- Time flies like an arrow. Fruit flies like a banana. /// Bram Moolenaar -- Bram@Moolenaar.net --
    Message 1 of 3 , Oct 28, 2009
    • 0 Attachment
      Lech Lorens wrote:

      > The attached patch fixes a problem with syntax-based folding. Steps to
      > reproduce:
      > - make sure that you have folding for comments in C source code enabled:
      > : if exists("c_no_comment_fold")
      > : unlet c_no_comment_fold
      > : endif
      >
      > - with the following settings:
      > :set ft=c fdm=syntax fdc=4 fdl=3 number
      >
      > - edit the following file:
      > 1 int fun1()
      > - 2 {
      > | 3 int i = 3;
      > | 4 switch (i)
      > |- 5 {
      > || 6 case 1:
      > ||- 7 {
      > ||| 8 }
      > || 9 case 2:
      > ||- 10 {
      > ||| 11 }
      > || 12 }
      > | 13 }
      >
      > - go to line 6 and start appending at the end of the line:
      > :6
      > :normal A
      > - enter a C-style comment (e.g. "/* comment */") observing how the
      > folding changes in the fold column.
      >
      > When you open the comment, the fold starting at line 4 extends to line
      > 13 and a new fold appears - from line 6 to line 13. However, after you
      > close the comment, although the fold at line 6 correctly disappears, the
      > length of the fold at line 5 is not adjusted and instead of two two-line
      > folds at lines 7 and 10, a single fold at line 7 appears, which extends
      > to line 13:
      > 1 int fun1()
      > - 2 {
      > | 3 int i = 3;
      > | 4 switch (i)
      > |- 5 {
      > || 6 case 1: /* comment */
      > ||- 7 {
      > ||| 8 }
      > ||| 9 case 2:
      > ||| 10 {
      > ||| 11 }
      > ||| 12 }
      > ||| 13 }
      >
      >
      > As mentioned, the attached patch removes the problem so that the
      > original folding is restored after the comment has been entered.

      Thanks, I'll look into it soon.

      --
      Time flies like an arrow.
      Fruit flies like a banana.

      /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
      /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
      \\\ download, build and distribute -- http://www.A-A-P.org ///
      \\\ help me help AIDS victims -- http://ICCF-Holland.org ///

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