forked from aniani/vim
patch 7.4.2347
Problem: Crash when closing a buffer while Visual mode is active. (Dominique Pelle) Solution: Adjust the position before computing the number of lines. When closing the current buffer stop Visual mode.
This commit is contained in:
@@ -578,6 +578,11 @@ aucmd_abort:
|
|||||||
if (buf->b_ffname == NULL)
|
if (buf->b_ffname == NULL)
|
||||||
del_buf = TRUE;
|
del_buf = TRUE;
|
||||||
|
|
||||||
|
/* When closing the current buffer stop Visual mode before freeing
|
||||||
|
* anything. */
|
||||||
|
if (buf == curbuf)
|
||||||
|
end_visual_mode();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Free all things allocated for this buffer.
|
* Free all things allocated for this buffer.
|
||||||
* Also calls the "BufDelete" autocommands when del_buf is TRUE.
|
* Also calls the "BufDelete" autocommands when del_buf is TRUE.
|
||||||
@@ -1379,6 +1384,10 @@ do_buffer(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* When closing the current buffer stop Visual mode. */
|
||||||
|
if (buf == curbuf)
|
||||||
|
end_visual_mode();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If deleting the last (listed) buffer, make it empty.
|
* If deleting the last (listed) buffer, make it empty.
|
||||||
* The last (listed) buffer cannot be unloaded.
|
* The last (listed) buffer cannot be unloaded.
|
||||||
|
@@ -1609,6 +1609,8 @@ do_pending_operator(cmdarg_T *cap, int old_col, int gui_yank)
|
|||||||
oap->start = curwin->w_cursor;
|
oap->start = curwin->w_cursor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Just in case lines were deleted that make the position invalid. */
|
||||||
|
check_pos(curwin->w_buffer, &oap->end);
|
||||||
oap->line_count = oap->end.lnum - oap->start.lnum + 1;
|
oap->line_count = oap->end.lnum - oap->start.lnum + 1;
|
||||||
|
|
||||||
#ifdef FEAT_VIRTUALEDIT
|
#ifdef FEAT_VIRTUALEDIT
|
||||||
@@ -9451,10 +9453,7 @@ get_op_vcol(
|
|||||||
#ifdef FEAT_MBYTE
|
#ifdef FEAT_MBYTE
|
||||||
/* prevent from moving onto a trail byte */
|
/* prevent from moving onto a trail byte */
|
||||||
if (has_mbyte)
|
if (has_mbyte)
|
||||||
{
|
|
||||||
check_pos(curwin->w_buffer, &oap->end);
|
|
||||||
mb_adjustpos(curwin->w_buffer, &oap->end);
|
mb_adjustpos(curwin->w_buffer, &oap->end);
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
getvvcol(curwin, &(oap->start), &oap->start_vcol, NULL, &oap->end_vcol);
|
getvvcol(curwin, &(oap->start), &oap->start_vcol, NULL, &oap->end_vcol);
|
||||||
|
@@ -1998,3 +1998,17 @@ func! Test_normal46_ignore()
|
|||||||
" clean up
|
" clean up
|
||||||
bw!
|
bw!
|
||||||
endfu
|
endfu
|
||||||
|
|
||||||
|
func! Test_normal47_visual_buf_wipe()
|
||||||
|
" This was causing a crash or ml_get error.
|
||||||
|
enew!
|
||||||
|
call setline(1,'xxx')
|
||||||
|
normal $
|
||||||
|
new
|
||||||
|
call setline(1, range(1,2))
|
||||||
|
2
|
||||||
|
exe "norm \<C-V>$"
|
||||||
|
bw!
|
||||||
|
norm yp
|
||||||
|
set nomodified
|
||||||
|
endfu
|
||||||
|
@@ -763,6 +763,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 */
|
||||||
|
/**/
|
||||||
|
2347,
|
||||||
/**/
|
/**/
|
||||||
2346,
|
2346,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user