mirror of
https://github.com/vim/vim.git
synced 2025-09-26 04:04:07 -04:00
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)
This commit is contained in:
11
src/ops.c
11
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);
|
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)
|
if (oap->block_mode)
|
||||||
{
|
{
|
||||||
curwin->w_cursor.lnum = oap->start.lnum;
|
curwin->w_cursor.lnum = oap->start.lnum;
|
||||||
@@ -277,6 +272,12 @@ op_shift(oparg_T *oap, int curs_top, int amount)
|
|||||||
else
|
else
|
||||||
--curwin->w_cursor.lnum; /* put cursor on last line, for ":>" */
|
--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->line_count > p_report)
|
||||||
{
|
{
|
||||||
if (oap->op_type == OP_RSHIFT)
|
if (oap->op_type == OP_RSHIFT)
|
||||||
|
@@ -63,3 +63,35 @@ function! Test_address_fold()
|
|||||||
|
|
||||||
quit!
|
quit!
|
||||||
endfunction
|
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
|
||||||
|
@@ -764,6 +764,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
136,
|
||||||
/**/
|
/**/
|
||||||
135,
|
135,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user