diff --git a/src/nvim/charset.c b/src/nvim/charset.c index a02d2a812d..231bff26e8 100644 --- a/src/nvim/charset.c +++ b/src/nvim/charset.c @@ -1344,7 +1344,11 @@ colnr_T getvcol_nolist(pos_T *posp) colnr_T vcol; curwin->w_p_list = false; - getvcol(curwin, posp, NULL, &vcol, NULL); + if (posp->coladd) { + getvvcol(curwin, posp, NULL, &vcol, NULL); + } else { + getvcol(curwin, posp, NULL, &vcol, NULL); + } curwin->w_p_list = list_save; return vcol; } diff --git a/src/nvim/testdir/test_virtualedit.vim b/src/nvim/testdir/test_virtualedit.vim index 2b8849f488..d49025237b 100644 --- a/src/nvim/testdir/test_virtualedit.vim +++ b/src/nvim/testdir/test_virtualedit.vim @@ -38,6 +38,24 @@ func Test_paste_end_of_line() exe "normal! 2G$lllA\:normal! \"agP\r" call assert_equal('123456', getline(2)) + bwipe! + set virtualedit= +endfunc + +func Test_edit_CTRL_G() + new + set virtualedit=insert + call setline(1, ['123', '1', '12']) + exe "normal! ggA\jx\jx" + call assert_equal(['123', '1 x', '12 x'], getline(1,'$')) + + set virtualedit=all + %d_ + call setline(1, ['1', '12']) + exe "normal! ggllix\jx" + call assert_equal(['1 x', '12x'], getline(1,'$')) + + bwipe! set virtualedit= endfunc