patch 9.1.0166: Internal error with blockwise getregion() in another buffer

Problem:  Internal error with blockwise getregion() in another buffer
Solution: Also change curwin->w_buffer when changing curbuf (zeertzjq)

closes: #14179

Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/src/testdir/test_visual.vim b/src/testdir/test_visual.vim
index ca13966..fd174a9 100644
--- a/src/testdir/test_visual.vim
+++ b/src/testdir/test_visual.vim
@@ -1768,11 +1768,11 @@
     for type in ['v', 'V', "\<C-V>"]
       for exclusive in [v:false, v:true]
         call assert_equal(range(10)->mapnew('string(v:val)'),
-              \ getregion([g:buf, 1, 1, 0], [g:buf, 10, 2, 0]),
-              \ {'type': type, 'exclusive': exclusive })
+              \ getregion([g:buf, 1, 1, 0], [g:buf, 10, 2, 0],
+              \ {'type': type, 'exclusive': exclusive }))
         call assert_equal(range(10)->mapnew('string(v:val)'),
-              \ getregion([g:buf, 10, 2, 0], [g:buf, 1, 1, 0]),
-              \ {'type': type, 'exclusive': exclusive })
+              \ getregion([g:buf, 10, 2, 0], [g:buf, 1, 1, 0],
+              \ {'type': type, 'exclusive': exclusive }))
       endfor
     endfor