diff options
| author | Johan Klokkhammer Helsing <johanhelsing@gmail.com> | 2015-11-08 10:19:02 +0100 | 
|---|---|---|
| committer | Florian Walch <florian@fwalch.com> | 2015-11-08 17:06:33 +0100 | 
| commit | f65e7bf30c8a00696d5740e35d0f84b9aa648b99 (patch) | |
| tree | cfbc7852859cf1c1f76e7ddaa72129b7dce63bd1 /src/nvim/normal.c | |
| parent | cbb70448788358c0da95090607a40a26f43bdb9f (diff) | |
| download | rneovim-f65e7bf30c8a00696d5740e35d0f84b9aa648b99.tar.gz rneovim-f65e7bf30c8a00696d5740e35d0f84b9aa648b99.tar.bz2 rneovim-f65e7bf30c8a00696d5740e35d0f84b9aa648b99.zip | |
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
Diffstat (limited to 'src/nvim/normal.c')
| -rw-r--r-- | src/nvim/normal.c | 18 | 
1 files changed, 15 insertions, 3 deletions
| diff --git a/src/nvim/normal.c b/src/nvim/normal.c index de575c0234..fce3558e9f 100644 --- a/src/nvim/normal.c +++ b/src/nvim/normal.c @@ -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 */ | 
