diff options
author | Bram Moolenaar <Bram@vim.org> | 2022-01-20 13:32:50 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-01-20 13:32:50 +0000 |
commit | 05b27615481e72e3b338bb12990fb3e0c2ecc2a9 (patch) | |
tree | 2bc73f0f7efd680d83cd1a9168fe2747d2dfea52 | |
parent | 4ac893f32109f29349661322676e5b81eb169b74 (diff) |
patch 8.2.4154: ml_get error when exchanging windows in Visual modev8.2.4154
Problem: ml_get error when exchanging windows in Visual mode.
Solution: Correct end of Visual area when entering another buffer.
-rw-r--r-- | src/testdir/test_visual.vim | 10 | ||||
-rw-r--r-- | src/version.c | 2 | ||||
-rw-r--r-- | src/window.c | 7 |
3 files changed, 18 insertions, 1 deletions
diff --git a/src/testdir/test_visual.vim b/src/testdir/test_visual.vim index a187aa8e08..72f5388b93 100644 --- a/src/testdir/test_visual.vim +++ b/src/testdir/test_visual.vim @@ -1318,5 +1318,15 @@ func Test_visual_block_insert_round_off() bwipe! endfunc +" this was causing an ml_get error +func Test_visual_exchange_windows() + enew! + new + call setline(1, ['foo', 'bar']) + exe "normal G\<C-V>gg\<C-W>\<C-X>OO\<Esc>" + bwipe! + bwipe! +endfunc + " vim: shiftwidth=2 sts=2 expandtab diff --git a/src/version.c b/src/version.c index 54a9ebee55..e32abbb79a 100644 --- a/src/version.c +++ b/src/version.c @@ -751,6 +751,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 4154, +/**/ 4153, /**/ 4152, diff --git a/src/window.c b/src/window.c index 05e85baf36..74257275c7 100644 --- a/src/window.c +++ b/src/window.c @@ -1691,6 +1691,11 @@ win_exchange(long Prenum) (void)win_comp_pos(); // recompute window positions + if (wp->w_buffer != curbuf) + reset_VIsual_and_resel(); + else if (VIsual_active) + wp->w_cursor = curwin->w_cursor; + win_enter(wp, TRUE); redraw_all_later(NOT_VALID); } @@ -5332,7 +5337,7 @@ frame_remove(frame_T *frp) win_alloc_lines(win_T *wp) { wp->w_lines_valid = 0; - wp->w_lines = ALLOC_CLEAR_MULT(wline_T, Rows ); + wp->w_lines = ALLOC_CLEAR_MULT(wline_T, Rows); if (wp->w_lines == NULL) return FAIL; return OK; |