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.
diff --git a/src/normal.c b/src/normal.c
index edaa740..92ef575 100644
--- a/src/normal.c
+++ b/src/normal.c
@@ -1609,6 +1609,8 @@
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 @@
#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);