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/testdir/test_normal.vim b/src/testdir/test_normal.vim
index b894a63..79af7b2 100644
--- a/src/testdir/test_normal.vim
+++ b/src/testdir/test_normal.vim
@@ -1998,3 +1998,17 @@
" clean up
bw!
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