Hi,

The following patch add support for setting a maximum fold level when
`foldmethod=marker'. AFAICS, it is not currently possible to do that, so I just
hijacked the `foldnestmax' setting. It would seem to work as I would expect, but
I do not really know the code, so maybe it is utterly broken in whatever
corner-case :) Anyway, any feedback appreciated !

Thanks in advance,
 - Arnaud

---
 src/fold.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/fold.c b/src/fold.c
index 800db61..d2bc065 100644
--- a/src/fold.c
+++ b/src/fold.c
@@ -503,6 +503,7 @@ newFoldLevel()
            if (wp != curwin && foldmethodIsDiff(wp) && wp->w_p_scb)
            {
                wp->w_p_fdl = curwin->w_p_fdl;
+               wp->w_p_fdn = curwin->w_p_fdn;
                newFoldLevelWin(wp);
            }
        }
@@ -650,7 +651,7 @@ foldCreate(start, end)
            if (use_level || fp->fd_flags == FD_LEVEL)
            {
                use_level = TRUE;
-               if (level >= curwin->w_p_fdl)
+               if (level >= curwin->w_p_fdl && level < curwin->w_p_fdn)
                    closed = TRUE;
            }
            else if (fp->fd_flags == FD_CLOSED)
@@ -1362,7 +1363,7 @@ setManualFoldWin(wp, lnum, opening, recurse, donep)
        if (use_level || fp->fd_flags == FD_LEVEL)
        {
            use_level = TRUE;
-           if (level >= wp->w_p_fdl)
+           if (level >= wp->w_p_fdl && level < wp->w_p_fdn)
                fp->fd_flags = FD_CLOSED;
            else
                fp->fd_flags = FD_OPEN;
@@ -1700,7 +1701,7 @@ check_closed(win, fp, use_levelp, level, maybe_smallp, 
lnum_off)
     if (*use_levelp || fp->fd_flags == FD_LEVEL)
     {
        *use_levelp = TRUE;
-       if (level >= win->w_p_fdl)
+       if (level >= win->w_p_fdl && level < win->w_p_fdn)
            closed = TRUE;
     }
     else if (fp->fd_flags == FD_CLOSED)
-- 
1.7.3.4.574.g608b.dirty

-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Raspunde prin e-mail lui