Hi,
attached is a patch, that fixes the observed behaviour and adds a test 
for both features, the one that 7.4a.017 fixed and the one complained 
below. Note however, that the patch depends on the patch posted here:
https://groups.google.com/d/msg/vim_dev/2uOkM4pS3hE/tg6KGlwqEAAJ
(e.g. it needs the test_fold.vim testfile from that particular patch).

Best,
Christian

On Do, 22 Dez 2016, Christian Brabandt wrote:

> Hi Jonathan!
> 
> On Do, 22 Dez 2016, Jonathan Fudger wrote:
> 
> > Hi everyone. I have been using Vim as my exclusive editor for about 15 
> > years, so thanks to everyone who keeps this wonderful project going. Now 
> > here's my bug report...
> > 
> > I have two separate folds, one above the other, with no line separating 
> > them. For example, with foldmethod=marker and foldmarker={{{,}}} I have a 
> > 4-line file:
> > 
> > {{{
> > }}}
> > {{{
> > }}}
> > 
> > When both the folds are closed, if I change the indent of the upper fold 
> > (using >> or << in normal mode) this causes the the lower fold to be 
> > opened. I can also reproduce this with foldmethod=indent.
> > 
> > This behaviour seems to have been introduced in vim74 (I cannot reproduce 
> > it in any builds of vim72 or vim73 on Windows or Linux). On Windows (vim 
> > and gvim) I can reproduce this behaviour in vim74.027, which is the 
> > earliest binary I could find in the Cream repository. It is present in all 
> > subsequent builds of vim74 and vim80.
> > 
> > Is this likely to be a straightforward fix? I'm happy to have a look for 
> > myself, but I have no knowledge of Vim's source code, so I would need some 
> > instruction.
> 
> I see the problem. This has been introduced as of 7.4a.17
> Strange, that nobody noticed until now.
> 
> #v+
> ~$ git log -v  -1 2b79bfdeab
> commit 2b79bfdeabbbe8f6e5378290c72c770f84796c08
> Author: Bram Moolenaar <[email protected]>
> Date:   Sat Jul 13 16:34:32 2013 +0200
> 
>     updated for version 7.4a.017
>     Problem:    When 'foldmethod' is "indent", using ">>" on a line just 
> above a
>                 fold makes the cursor line folded. (Evan Laforge)
>     Solution:   Call foldOpenCursor(). (Christian Brabandt)
> #v-
> 
> Sorry for causing this. I think this patch fixes it. If it does, I'll 
> create a proper fix with a test for both problems, the one that 7.4a.17 
> fixed and the one you noticed.
> 
> diff --git a/src/ops.c b/src/ops.c
> index 4bef6c5..f966cb9 100644
> --- a/src/ops.c
> +++ b/src/ops.c
> @@ -259,11 +259,6 @@ op_shift(oparg_T *oap, int curs_top, int amount)
>      }
> 
>      changed_lines(oap->start.lnum, 0, oap->end.lnum + 1, 0L);
> -#ifdef FEAT_FOLDING
> -    /* The cursor line is not in a closed fold */
> -    foldOpenCursor();
> -#endif
> -
>      if (oap->block_mode)
>      {
>         curwin->w_cursor.lnum = oap->start.lnum;
> @@ -277,6 +272,12 @@ op_shift(oparg_T *oap, int curs_top, int amount)
>      else
>         --curwin->w_cursor.lnum;        /* put cursor on last line, for ":>" 
> */
> 
> +#ifdef FEAT_FOLDING
> +    /* The cursor line is not in a closed fold */
> +    foldOpenCursor();
> +#endif
> +
> +
>      if (oap->line_count > p_report)
>      {
>         if (oap->op_type == OP_RSHIFT)
> 
> 
> 
> Best,
> Christian

Mit freundlichen Grüßen
Christian
-- 
Treffen sich zwei Yetis im Himalaja.  Sagt der eine:
"Du, ich hab' gestern Reinhold Messner gesehen."
Sagt der andere: "Was? Gibt's den wirklich?"

-- 
-- 
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

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.
From 5326750880b509a502ba4362af8d949894c4e932 Mon Sep 17 00:00:00 2001
From: Christian Brabandt <[email protected]>
Date: Thu, 29 Dec 2016 20:47:39 +0100
Subject: [PATCH] open correct line after shifting folded lines

---
 src/ops.c                 | 11 ++++++-----
 src/testdir/test_fold.vim | 32 ++++++++++++++++++++++++++++++++
 2 files changed, 38 insertions(+), 5 deletions(-)

diff --git a/src/ops.c b/src/ops.c
index 4bef6c5..f966cb9 100644
--- a/src/ops.c
+++ b/src/ops.c
@@ -259,11 +259,6 @@ op_shift(oparg_T *oap, int curs_top, int amount)
     }
 
     changed_lines(oap->start.lnum, 0, oap->end.lnum + 1, 0L);
-#ifdef FEAT_FOLDING
-    /* The cursor line is not in a closed fold */
-    foldOpenCursor();
-#endif
-
     if (oap->block_mode)
     {
 	curwin->w_cursor.lnum = oap->start.lnum;
@@ -277,6 +272,12 @@ op_shift(oparg_T *oap, int curs_top, int amount)
     else
 	--curwin->w_cursor.lnum;	/* put cursor on last line, for ":>" */
 
+#ifdef FEAT_FOLDING
+    /* The cursor line is not in a closed fold */
+    foldOpenCursor();
+#endif
+
+
     if (oap->line_count > p_report)
     {
 	if (oap->op_type == OP_RSHIFT)
diff --git a/src/testdir/test_fold.vim b/src/testdir/test_fold.vim
index 1b52e92..9bd87f7 100644
--- a/src/testdir/test_fold.vim
+++ b/src/testdir/test_fold.vim
@@ -63,3 +63,35 @@ function! Test_address_fold()
 
   quit!
 endfunction
+
+function! Test_indent_fold()
+    new
+    call setline(1, ['', 'a', '    b', '    c'])
+    setl fen fdm=indent
+    2
+    norm! >>
+    let a=map(range(1,4), 'foldclosed(v:val)')
+    call assert_equal(a, [-1,-1,-1,-1])
+endfu
+
+function! Test_indent_fold()
+    new
+    call setline(1, ['', 'a', '    b', '    c'])
+    setl fen fdm=indent
+    2
+    norm! >>
+    let a=map(range(1,4), 'foldclosed(v:val)')
+    call assert_equal(a, [-1,-1,-1,-1])
+    bw!
+endfu
+
+function! Test_indent_fold2()
+    new
+    call setline(1, ['', '{{{', '}}}', '{{{', '}}}'])
+    setl fen fdm=marker
+    2
+    norm! >>
+    let a=map(range(1,5), 'foldclosed(v:val)')
+    call assert_equal(a, [-1,-1,-1,4,4])
+    bw!
+endfu
-- 
2.10.2

Raspunde prin e-mail lui