To: vim_dev@googlegroups.com Subject: Patch 8.0.0136 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.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) Files: src/ops.c, src/testdir/test_fold.vim *** ../vim-8.0.0135/src/ops.c 2016-09-04 14:59:01.000000000 +0200 --- src/ops.c 2017-01-02 14:32:20.473091162 +0100 *************** *** 259,269 **** } 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; --- 259,264 ---- *************** *** 277,282 **** --- 272,283 ---- 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) *** ../vim-8.0.0135/src/testdir/test_fold.vim 2017-01-02 14:27:15.619201170 +0100 --- src/testdir/test_fold.vim 2017-01-02 14:56:24.555093806 +0100 *************** *** 63,65 **** --- 63,97 ---- 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 *** ../vim-8.0.0135/src/version.c 2017-01-02 14:27:15.619201170 +0100 --- src/version.c 2017-01-02 14:34:18.560273981 +0100 *************** *** 766,767 **** --- 766,769 ---- { /* Add new patch number below this line */ + /**/ + 136, /**/ -- Living in Hollywood is like living in a bowl of granola. What ain't fruits and nuts is flakes. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///