Navigation Menu

Skip to content

Commit

Permalink
patch 8.2.4215: illegal memory access when copying lines in Visual mode
Browse files Browse the repository at this point in the history
Problem:    Illegal memory access when copying lines in Visual mode.
Solution:   Adjust the Visual position after copying lines.
  • Loading branch information
brammool committed Jan 25, 2022
1 parent 85b6747 commit dc5490e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/ex_cmds.c
Expand Up @@ -866,6 +866,8 @@ ex_copy(linenr_T line1, linenr_T line2, linenr_T n)
}

appended_lines_mark(n, count);
if (VIsual_active)
check_pos(curbuf, &VIsual);

msgmore((long)count);
}
Expand Down
11 changes: 11 additions & 0 deletions src/testdir/test_visual.vim
Expand Up @@ -1328,5 +1328,16 @@ func Test_visual_exchange_windows()
bwipe!
endfunc

" this was leaving the end of the Visual area beyond the end of a line
func Test_visual_ex_copy_line()
new
call setline(1, ["aaa", "bbbbbbbbbxbb"])
/x
exe "normal ggvjfxO"
t0
normal gNU
bwipe!
endfunc


" vim: shiftwidth=2 sts=2 expandtab
2 changes: 2 additions & 0 deletions src/version.c
Expand Up @@ -750,6 +750,8 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
/**/
4215,
/**/
4214,
/**/
Expand Down

0 comments on commit dc5490e

Please sign in to comment.