]> granicus.if.org Git - vim/commitdiff
updated for version 7.2-274 v7.2.274
authorBram Moolenaar <Bram@vim.org>
Tue, 3 Nov 2009 13:46:54 +0000 (13:46 +0000)
committerBram Moolenaar <Bram@vim.org>
Tue, 3 Nov 2009 13:46:54 +0000 (13:46 +0000)
src/fold.c
src/testdir/test45.in
src/testdir/test45.ok
src/version.c

index a127bf67cc6d63400efa808f48eb02ef4b4b5fac..f3be3788d371278cbd3da84169d2631cdff5d382 100644 (file)
@@ -2256,6 +2256,40 @@ foldUpdateIEMS(wp, top, bot)
        }
     }
 
+    /*
+     * If folding is defined by the syntax, it is possible that a change in
+     * one line will cause all sub-folds of the current fold to change (e.g.,
+     * closing a C-style comment can cause folds in the subsequent lines to
+     * appear). To take that into account we should adjust the value of "bot"
+     * to point to the end of the current fold:
+     */
+    if (foldlevelSyntax == getlevel)
+    {
+       garray_T *gap = &wp->w_folds;
+       fold_T   *fp = NULL;
+       int       current_fdl = 0;
+       linenr_T  fold_start_lnum = 0;
+       linenr_T  lnum_rel = fline.lnum;
+
+       while (current_fdl < fline.lvl)
+       {
+           if (!foldFind(gap, lnum_rel, &fp))
+               break;
+           ++current_fdl;
+
+           fold_start_lnum += fp->fd_top;
+           gap = &fp->fd_nested;
+           lnum_rel -= fp->fd_top;
+       }
+       if (fp != NULL && current_fdl == fline.lvl)
+       {
+           linenr_T fold_end_lnum = fold_start_lnum + fp->fd_len;
+
+           if (fold_end_lnum > bot)
+               bot = fold_end_lnum;
+       }
+    }
+
     start = fline.lnum;
     end = bot;
     /* Do at least one line. */
index cc991497767c561d7d37b22f67ab91c766746755..1dfad5454fc4e7cbec72614f978219c8a4774f61 100644 (file)
@@ -28,9 +28,14 @@ i  \ejI    \e:call append("$", "indent " . foldlevel("."))
 k:call append("$", foldlevel("."))
 :" test syntax folding
 :set fdm=syntax fdl=0
-:syn region Hup start="dd" end="hh" fold
+:syn region Hup start="dd" end="ii" fold contains=Fd1,Fd2,Fd3
+:syn region Fd1 start="ee" end="ff" fold contained
+:syn region Fd2 start="gg" end="hh" fold contained
+:syn region Fd3 start="commentstart" end="commentend" fold contained
 Gzk:call append("$", "folding " . getline("."))
 k:call append("$", getline("."))
+jAcommentstart  \eAcommentend\e:set fdl=1
+3j:call append("$", getline("."))
 :" test expression folding
 :fun Flvl()
   let l = getline(v:lnum)
index f5a1380e5ef445c98d25a1143da6990c293bb7da..713cf882ec8f27b52a85eb54f3d9267255de5b1e 100644 (file)
@@ -8,8 +8,9 @@ marker 2
 0
 indent 2
 1
-folding 8 hh
+folding 9 ii
     3 cc
+7 gg
 expr 2
 1
 2
index 3c38d2297fe658114ff1afac2239a26067f35f67..9f0ec933ca03210332b28553167175cb2d7bf2ff 100644 (file)
@@ -676,6 +676,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    274,
 /**/
     273,
 /**/