summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2017-01-02 14:57:08 +0100
committerBram Moolenaar <Bram@vim.org>2017-01-02 14:57:08 +0100
commit54b2bfa399017ebae76ed62f21578261d1b55c1f (patch)
tree30c05c78ca2efbe24a73064e337a7ba48c30868d
parentded2782783f352201ac0b05c6dbe4831adb4a58b (diff)
downloadvim-git-54b2bfa399017ebae76ed62f21578261d1b55c1f.tar.gz
patch 8.0.0136v8.0.0136
Problem: When using indent folding and changing indent the wrong fold is opened. (Jonathan Fudger) Solution: Open the fold under the cursor a bit later. (Christian Brabandt)
-rw-r--r--src/ops.c11
-rw-r--r--src/testdir/test_fold.vim32
-rw-r--r--src/version.c2
3 files changed, 40 insertions, 5 deletions
diff --git a/src/ops.c b/src/ops.c
index 4bef6c5a2..f966cb964 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 1b52e92a0..2ac000450 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([-1,-1,-1,-1], a)
+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([-1,-1,-1,-1], a)
+ 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([-1,-1,-1,4,4], a)
+ bw!
+endfu
diff --git a/src/version.c b/src/version.c
index b3f7c9732..f4f20fa26 100644
--- a/src/version.c
+++ b/src/version.c
@@ -765,6 +765,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 136,
+/**/
135,
/**/
134,