|
Karsten Hopp |
c3d9d9 |
To: vim-dev@vim.org
|
|
Karsten Hopp |
c3d9d9 |
Subject: Patch 7.2.274
|
|
Karsten Hopp |
c3d9d9 |
Fcc: outbox
|
|
Karsten Hopp |
c3d9d9 |
From: Bram Moolenaar <Bram@moolenaar.net>
|
|
Karsten Hopp |
c3d9d9 |
Mime-Version: 1.0
|
|
Karsten Hopp |
c3d9d9 |
Content-Type: text/plain; charset=UTF-8
|
|
Karsten Hopp |
c3d9d9 |
Content-Transfer-Encoding: 8bit
|
|
Karsten Hopp |
c3d9d9 |
------------
|
|
Karsten Hopp |
c3d9d9 |
|
|
Karsten Hopp |
c3d9d9 |
Patch 7.2.274
|
|
Karsten Hopp |
c3d9d9 |
Problem: Syntax folding doesn't work properly when adding a comment.
|
|
Karsten Hopp |
c3d9d9 |
Solution: Fix it and add a test. (Lech Lorens)
|
|
Karsten Hopp |
c3d9d9 |
Files: src/fold.c, src/testdir/test45.in, src/testdir/test45.ok
|
|
Karsten Hopp |
c3d9d9 |
|
|
Karsten Hopp |
c3d9d9 |
|
|
Karsten Hopp |
c3d9d9 |
*** ../vim-7.2.273/src/fold.c 2009-09-18 15:16:37.000000000 +0200
|
|
Karsten Hopp |
c3d9d9 |
--- src/fold.c 2009-11-03 12:36:37.000000000 +0100
|
|
Karsten Hopp |
c3d9d9 |
***************
|
|
Karsten Hopp |
c3d9d9 |
*** 2256,2261 ****
|
|
Karsten Hopp |
c3d9d9 |
--- 2256,2295 ----
|
|
Karsten Hopp |
c3d9d9 |
}
|
|
Karsten Hopp |
c3d9d9 |
}
|
|
Karsten Hopp |
c3d9d9 |
|
|
Karsten Hopp |
c3d9d9 |
+ /*
|
|
Karsten Hopp |
c3d9d9 |
+ * If folding is defined by the syntax, it is possible that a change in
|
|
Karsten Hopp |
c3d9d9 |
+ * one line will cause all sub-folds of the current fold to change (e.g.,
|
|
Karsten Hopp |
c3d9d9 |
+ * closing a C-style comment can cause folds in the subsequent lines to
|
|
Karsten Hopp |
c3d9d9 |
+ * appear). To take that into account we should adjust the value of "bot"
|
|
Karsten Hopp |
c3d9d9 |
+ * to point to the end of the current fold:
|
|
Karsten Hopp |
c3d9d9 |
+ */
|
|
Karsten Hopp |
c3d9d9 |
+ if (foldlevelSyntax == getlevel)
|
|
Karsten Hopp |
c3d9d9 |
+ {
|
|
Karsten Hopp |
c3d9d9 |
+ garray_T *gap = &wp->w_folds;
|
|
Karsten Hopp |
c3d9d9 |
+ fold_T *fp = NULL;
|
|
Karsten Hopp |
c3d9d9 |
+ int current_fdl = 0;
|
|
Karsten Hopp |
c3d9d9 |
+ linenr_T fold_start_lnum = 0;
|
|
Karsten Hopp |
c3d9d9 |
+ linenr_T lnum_rel = fline.lnum;
|
|
Karsten Hopp |
c3d9d9 |
+
|
|
Karsten Hopp |
c3d9d9 |
+ while (current_fdl < fline.lvl)
|
|
Karsten Hopp |
c3d9d9 |
+ {
|
|
Karsten Hopp |
c3d9d9 |
+ if (!foldFind(gap, lnum_rel, &fp))
|
|
Karsten Hopp |
c3d9d9 |
+ break;
|
|
Karsten Hopp |
c3d9d9 |
+ ++current_fdl;
|
|
Karsten Hopp |
c3d9d9 |
+
|
|
Karsten Hopp |
c3d9d9 |
+ fold_start_lnum += fp->fd_top;
|
|
Karsten Hopp |
c3d9d9 |
+ gap = &fp->fd_nested;
|
|
Karsten Hopp |
c3d9d9 |
+ lnum_rel -= fp->fd_top;
|
|
Karsten Hopp |
c3d9d9 |
+ }
|
|
Karsten Hopp |
c3d9d9 |
+ if (fp != NULL && current_fdl == fline.lvl)
|
|
Karsten Hopp |
c3d9d9 |
+ {
|
|
Karsten Hopp |
c3d9d9 |
+ linenr_T fold_end_lnum = fold_start_lnum + fp->fd_len;
|
|
Karsten Hopp |
c3d9d9 |
+
|
|
Karsten Hopp |
c3d9d9 |
+ if (fold_end_lnum > bot)
|
|
Karsten Hopp |
c3d9d9 |
+ bot = fold_end_lnum;
|
|
Karsten Hopp |
c3d9d9 |
+ }
|
|
Karsten Hopp |
c3d9d9 |
+ }
|
|
Karsten Hopp |
c3d9d9 |
+
|
|
Karsten Hopp |
c3d9d9 |
start = fline.lnum;
|
|
Karsten Hopp |
c3d9d9 |
end = bot;
|
|
Karsten Hopp |
c3d9d9 |
/* Do at least one line. */
|
|
Karsten Hopp |
c3d9d9 |
*** ../vim-7.2.273/src/testdir/test45.in 2007-09-25 17:58:43.000000000 +0200
|
|
Karsten Hopp |
c3d9d9 |
--- src/testdir/test45.in 2009-11-03 12:22:38.000000000 +0100
|
|
Karsten Hopp |
c3d9d9 |
***************
|
|
Karsten Hopp |
c3d9d9 |
*** 28,36 ****
|
|
Karsten Hopp |
c3d9d9 |
k:call append("$", foldlevel("."))
|
|
Karsten Hopp |
c3d9d9 |
:" test syntax folding
|
|
Karsten Hopp |
c3d9d9 |
:set fdm=syntax fdl=0
|
|
Karsten Hopp |
c3d9d9 |
! :syn region Hup start="dd" end="hh" fold
|
|
Karsten Hopp |
c3d9d9 |
Gzk:call append("$", "folding " . getline("."))
|
|
Karsten Hopp |
c3d9d9 |
k:call append("$", getline("."))
|
|
Karsten Hopp |
c3d9d9 |
:" test expression folding
|
|
Karsten Hopp |
c3d9d9 |
:fun Flvl()
|
|
Karsten Hopp |
c3d9d9 |
let l = getline(v:lnum)
|
|
Karsten Hopp |
c3d9d9 |
--- 28,41 ----
|
|
Karsten Hopp |
c3d9d9 |
k:call append("$", foldlevel("."))
|
|
Karsten Hopp |
c3d9d9 |
:" test syntax folding
|
|
Karsten Hopp |
c3d9d9 |
:set fdm=syntax fdl=0
|
|
Karsten Hopp |
c3d9d9 |
! :syn region Hup start="dd" end="ii" fold contains=Fd1,Fd2,Fd3
|
|
Karsten Hopp |
c3d9d9 |
! :syn region Fd1 start="ee" end="ff" fold contained
|
|
Karsten Hopp |
c3d9d9 |
! :syn region Fd2 start="gg" end="hh" fold contained
|
|
Karsten Hopp |
c3d9d9 |
! :syn region Fd3 start="commentstart" end="commentend" fold contained
|
|
Karsten Hopp |
c3d9d9 |
Gzk:call append("$", "folding " . getline("."))
|
|
Karsten Hopp |
c3d9d9 |
k:call append("$", getline("."))
|
|
Karsten Hopp |
c3d9d9 |
+ jAcommentstart ?Acommentend?:set fdl=1
|
|
Karsten Hopp |
c3d9d9 |
+ 3j:call append("$", getline("."))
|
|
Karsten Hopp |
c3d9d9 |
:" test expression folding
|
|
Karsten Hopp |
c3d9d9 |
:fun Flvl()
|
|
Karsten Hopp |
c3d9d9 |
let l = getline(v:lnum)
|
|
Karsten Hopp |
c3d9d9 |
*** ../vim-7.2.273/src/testdir/test45.ok 2004-06-13 17:47:37.000000000 +0200
|
|
Karsten Hopp |
c3d9d9 |
--- src/testdir/test45.ok 2009-11-03 12:22:50.000000000 +0100
|
|
Karsten Hopp |
c3d9d9 |
***************
|
|
Karsten Hopp |
c3d9d9 |
*** 8,15 ****
|
|
Karsten Hopp |
c3d9d9 |
0
|
|
Karsten Hopp |
c3d9d9 |
indent 2
|
|
Karsten Hopp |
c3d9d9 |
1
|
|
Karsten Hopp |
c3d9d9 |
! folding 8 hh
|
|
Karsten Hopp |
c3d9d9 |
3 cc
|
|
Karsten Hopp |
c3d9d9 |
expr 2
|
|
Karsten Hopp |
c3d9d9 |
1
|
|
Karsten Hopp |
c3d9d9 |
2
|
|
Karsten Hopp |
c3d9d9 |
--- 8,16 ----
|
|
Karsten Hopp |
c3d9d9 |
0
|
|
Karsten Hopp |
c3d9d9 |
indent 2
|
|
Karsten Hopp |
c3d9d9 |
1
|
|
Karsten Hopp |
c3d9d9 |
! folding 9 ii
|
|
Karsten Hopp |
c3d9d9 |
3 cc
|
|
Karsten Hopp |
c3d9d9 |
+ 7 gg
|
|
Karsten Hopp |
c3d9d9 |
expr 2
|
|
Karsten Hopp |
c3d9d9 |
1
|
|
Karsten Hopp |
c3d9d9 |
2
|
|
Karsten Hopp |
c3d9d9 |
*** ../vim-7.2.273/src/version.c 2009-11-03 14:26:29.000000000 +0100
|
|
Karsten Hopp |
c3d9d9 |
--- src/version.c 2009-11-03 14:44:21.000000000 +0100
|
|
Karsten Hopp |
c3d9d9 |
***************
|
|
Karsten Hopp |
c3d9d9 |
*** 678,679 ****
|
|
Karsten Hopp |
c3d9d9 |
--- 678,681 ----
|
|
Karsten Hopp |
c3d9d9 |
{ /* Add new patch number below this line */
|
|
Karsten Hopp |
c3d9d9 |
+ /**/
|
|
Karsten Hopp |
c3d9d9 |
+ 274,
|
|
Karsten Hopp |
c3d9d9 |
/**/
|
|
Karsten Hopp |
c3d9d9 |
|
|
Karsten Hopp |
c3d9d9 |
--
|
|
Karsten Hopp |
c3d9d9 |
BRIDGEKEEPER: What is your favorite colour?
|
|
Karsten Hopp |
c3d9d9 |
LAUNCELOT: Blue.
|
|
Karsten Hopp |
c3d9d9 |
BRIDGEKEEPER: Right. Off you go.
|
|
Karsten Hopp |
c3d9d9 |
"Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
|
|
Karsten Hopp |
c3d9d9 |
|
|
Karsten Hopp |
c3d9d9 |
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
|
|
Karsten Hopp |
c3d9d9 |
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
|
|
Karsten Hopp |
c3d9d9 |
\\\ download, build and distribute -- http://www.A-A-P.org ///
|
|
Karsten Hopp |
c3d9d9 |
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|