changeset 6725:bc62d1988bf2 v7.4.686

updated for version 7.4.686 Problem: "zr" and "zm" do not take a count. Solution: Implement the count, restrict the fold level to the maximum nesting depth. (Marcin Szamotulski)
author Bram Moolenaar <bram@vim.org>
date Tue, 31 Mar 2015 17:46:22 +0200
parents 635544d02ef6
children dcbb44996c5e
files runtime/doc/fold.txt src/normal.c src/version.c
diffstat 3 files changed, 16 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/runtime/doc/fold.txt
+++ b/runtime/doc/fold.txt
@@ -365,7 +365,7 @@ zX		Undo manually opened and closed fold
 		Also forces recomputing folds, like |zx|.
 
 							*zm*
-zm		Fold more: Subtract one from 'foldlevel'.  If 'foldlevel' was
+zm		Fold more: Subtract |v:count1| from 'foldlevel'.  If 'foldlevel' was
 		already zero nothing happens.
 		'foldenable' will be set.
 
@@ -374,7 +374,7 @@ zM		Close all folds: set 'foldlevel' to 
 		'foldenable' will be set.
 
 							*zr*
-zr		Reduce folding: Add one to 'foldlevel'.
+zr		Reduce folding: Add |v:count1| to 'foldlevel'.
 
 							*zR*
 zR		Open all folds.  This sets 'foldlevel' to highest fold level.
--- a/src/normal.c
+++ b/src/normal.c
@@ -5098,7 +5098,11 @@ dozet:
 
 		/* "zm": fold more */
     case 'm':	if (curwin->w_p_fdl > 0)
-		    --curwin->w_p_fdl;
+		{
+		    curwin->w_p_fdl -= cap->count1;
+		    if (curwin->w_p_fdl < 0)
+			curwin->w_p_fdl = 0;
+		}
 		old_fdl = -1;		/* force an update */
 		curwin->w_p_fen = TRUE;
 		break;
@@ -5110,7 +5114,13 @@ dozet:
 		break;
 
 		/* "zr": reduce folding */
-    case 'r':	++curwin->w_p_fdl;
+    case 'r':	curwin->w_p_fdl += cap->count1;
+		{
+		    int d = getDeepestNesting();
+
+		    if (curwin->w_p_fdl >= d)
+			curwin->w_p_fdl = d;
+		}
 		break;
 
 		/* "zR": open all folds */
--- a/src/version.c
+++ b/src/version.c
@@ -742,6 +742,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    686,
+/**/
     685,
 /**/
     684,