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
-- 
Adel ist auch in der sittlichen Welt. Gemeine Naturen zahlen mit dem, 
was sie tun, edle mit dem, was sie sind.
                -- Friedrich Schiller (Unterschied der Stände)

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

Raspunde prin e-mail lui