vim-patch:7.4.686 #3629

Problem:    "zr" and "zm" do not take a count.
Solution:   Implement the count, restrict the fold level to the maximum
            nesting depth.  (Marcin Szamotulski)

https://github.com/vim/vim/commit/7d2757a47204d00cd47e3db94f1bd248c499d4e3
This commit is contained in:
Johan Klokkhammer Helsing authored and Florian Walch committed 2015-11-08 17:06:33 +01:00
1 parent cbb7044878
commit f65e7bf30c
3 files changed
+18 -6

No files matched your search

+2 -2
View File
@@ -362,7 +362,7 @@ zX Undo manually opened and closed folds: re-apply 'foldlevel'.
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.
@@ -371,7 +371,7 @@ zM Close all folds: set 'foldlevel' to 0.
'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.
+15 -3
View File
@@ -4253,8 +4253,13 @@ dozet:
break;
/* "zm": fold more */
case 'm': if (curwin->w_p_fdl > 0)
--curwin->w_p_fdl;
case 'm':
if (curwin->w_p_fdl > 0) {
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;
@@ -4266,7 +4271,14 @@ 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 */
+1 -1
View File
@@ -238,7 +238,7 @@ static int included_patches[] = {
// 689,
// 688,
// 687 NA
// 686,
686,
// 685,
// 684,
// 683 NA