Problem: "zr" and "zm" do not take a count.
Solution: Implement the count, restrict the fold level to the maximum
nesting depth. (Marcin Szamotulski)
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.
'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.
/* "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;
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 */
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 686,
/**/
685,
/**/