summaryrefslogtreecommitdiff
path: root/src/normal.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2016-09-08 23:35:30 +0200
committerBram Moolenaar <Bram@vim.org>2016-09-08 23:35:30 +0200
commitc4a908e83690844b0d3a46124ba6af7d23485d69 (patch)
tree1a38f95d4fb857bd49b70a60e9de225c19b4574a /src/normal.c
parentabd468ed0fbcba391e7833feeaa7de3ced841455 (diff)
downloadvim-git-c4a908e83690844b0d3a46124ba6af7d23485d69.tar.gz
patch 7.4.2347v7.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.
Diffstat (limited to 'src/normal.c')
-rw-r--r--src/normal.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/normal.c b/src/normal.c
index edaa740e4..92ef575d2 100644
--- a/src/normal.c
+++ b/src/normal.c
@@ -1609,6 +1609,8 @@ do_pending_operator(cmdarg_T *cap, int old_col, int gui_yank)
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;
#ifdef FEAT_VIRTUALEDIT
@@ -9451,10 +9453,7 @@ get_op_vcol(
#ifdef FEAT_MBYTE
/* prevent from moving onto a trail byte */
if (has_mbyte)
- {
- check_pos(curwin->w_buffer, &oap->end);
mb_adjustpos(curwin->w_buffer, &oap->end);
- }
#endif
getvvcol(curwin, &(oap->start), &oap->start_vcol, NULL, &oap->end_vcol);