From 1d8c612f788b1a5c8d74814db4654462e0224831 Mon Sep 17 00:00:00 2001 From: KunMing Xie Date: Mon, 1 Jan 2018 23:08:26 +0800 Subject: 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 --- src/nvim/search.c | 5 +++++ src/nvim/testdir/test_visual.vim | 7 +++++++ 2 files changed, 12 insertions(+) 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 -- cgit