aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKunMing Xie <qqzz014@gmail.com>2018-01-01 23:08:26 +0800
committerJustin M. Keyes <justinkz@gmail.com>2018-01-01 16:08:26 +0100
commit1d8c612f788b1a5c8d74814db4654462e0224831 (patch)
tree22db9a8729e2956e4b5c4cc24a3283f6c919906b /src
parent907b2f18f7c35eb289357aa08e00178562b65a42 (diff)
downloadrneovim-1d8c612f788b1a5c8d74814db4654462e0224831.tar.gz
rneovim-1d8c612f788b1a5c8d74814db4654462e0224831.tar.bz2
rneovim-1d8c612f788b1a5c8d74814db4654462e0224831.zip
vim-patch:8.0.0339: illegal memory access with vi' (#7794)
Problem: Illegal memory access with vi' Solution: For quoted text objects bail out if the Visual area spans more than one line. https://github.com/vim/vim/commit/46522af72424c7fadfa7a4cbba3dd21b82d19131
Diffstat (limited to 'src')
-rw-r--r--src/nvim/search.c5
-rw-r--r--src/nvim/testdir/test_visual.vim7
2 files changed, 12 insertions, 0 deletions
diff --git a/src/nvim/search.c b/src/nvim/search.c
index 387614fd09..1eb1a25a19 100644
--- a/src/nvim/search.c
+++ b/src/nvim/search.c
@@ -3669,6 +3669,11 @@ current_quote (
/* Correct cursor when 'selection' is exclusive */
if (VIsual_active) {
+ // this only works within one line
+ if (VIsual.lnum != curwin->w_cursor.lnum) {
+ return false;
+ }
+
vis_bef_curs = lt(VIsual, curwin->w_cursor);
if (*p_sel == 'e' && vis_bef_curs)
dec_cursor();
diff --git a/src/nvim/testdir/test_visual.vim b/src/nvim/testdir/test_visual.vim
index 1694adbd32..69607e642c 100644
--- a/src/nvim/testdir/test_visual.vim
+++ b/src/nvim/testdir/test_visual.vim
@@ -43,3 +43,10 @@ func Test_dotregister_paste()
call assert_equal('hello world world', getline(1))
q!
endfunc
+
+func Test_Visual_inner_quote()
+ new
+ normal oxX
+ normal vki'
+ bwipe!
+endfunc