diff options
author | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2021-07-04 11:00:48 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-04 11:00:48 -0400 |
commit | 18bfcfe77f007f146a7251aa3cc6129891390c30 (patch) | |
tree | 741849ac08038690779f833bb33d204ba4978eee /src | |
parent | 490615612ed5ec587c8023de28db495b3181de30 (diff) | |
parent | 0d75b0d8d470fdf763743823feb6d9013eff069c (diff) | |
download | rneovim-18bfcfe77f007f146a7251aa3cc6129891390c30.tar.gz rneovim-18bfcfe77f007f146a7251aa3cc6129891390c30.tar.bz2 rneovim-18bfcfe77f007f146a7251aa3cc6129891390c30.zip |
Merge pull request #14981 from janlazo/vim-8.2.3081
vim-patch:8.2.{3081,3082,3085,3087,3088,3093,3094,3097,3098}
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/buffer.c | 3 | ||||
-rw-r--r-- | src/nvim/screen.c | 7 | ||||
-rw-r--r-- | src/nvim/testdir/check.vim | 11 | ||||
-rw-r--r-- | src/nvim/testdir/test_filetype.vim | 2 | ||||
-rw-r--r-- | src/nvim/testdir/test_swap.vim | 12 | ||||
-rw-r--r-- | src/nvim/testdir/test_visual.vim | 21 |
6 files changed, 54 insertions, 2 deletions
diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c index f1f32076bf..8decd02b3a 100644 --- a/src/nvim/buffer.c +++ b/src/nvim/buffer.c @@ -901,7 +901,10 @@ void handle_swap_exists(bufref_T *old_curbuf) if (old_curbuf == NULL || !bufref_valid(old_curbuf) || old_curbuf->br_buf == curbuf) { + // Block autocommands here because curwin->w_buffer is NULL. + block_autocmds(); buf = buflist_new(NULL, NULL, 1L, BLN_CURBUF | BLN_LISTED); + unblock_autocmds(); } else { buf = old_curbuf->br_buf; } diff --git a/src/nvim/screen.c b/src/nvim/screen.c index 3446a944cd..cab41d1783 100644 --- a/src/nvim/screen.c +++ b/src/nvim/screen.c @@ -1186,9 +1186,12 @@ static void win_update(win_T *wp, Providers *providers) getvcols(wp, &VIsual, &curwin->w_cursor, &fromc, &toc); ve_flags = save_ve_flags; - ++toc; - if (curwin->w_curswant == MAXCOL) + toc++; + // Highlight to the end of the line, unless 'virtualedit' has + // "block". + if (curwin->w_curswant == MAXCOL && !(ve_flags & VE_BLOCK)) { toc = MAXCOL; + } if (fromc != wp->w_old_cursor_fcol || toc != wp->w_old_cursor_lcol) { diff --git a/src/nvim/testdir/check.vim b/src/nvim/testdir/check.vim index 7b06e53dd5..14bab33a2f 100644 --- a/src/nvim/testdir/check.vim +++ b/src/nvim/testdir/check.vim @@ -9,6 +9,17 @@ func CheckFeature(name) endif endfunc +" Command to check for the absence of a feature. +command -nargs=1 CheckNotFeature call CheckNotFeature(<f-args>) +func CheckNotFeature(name) + if !has(a:name, 1) + throw 'Checking for non-existent feature ' .. a:name + endif + if has(a:name) + throw 'Skipped: ' .. a:name .. ' feature present' + endif +endfunc + " Command to check for the presence of a working option. command -nargs=1 CheckOption call CheckOption(<f-args>) func CheckOption(name) diff --git a/src/nvim/testdir/test_filetype.vim b/src/nvim/testdir/test_filetype.vim index eb6151fbe1..18b810e63f 100644 --- a/src/nvim/testdir/test_filetype.vim +++ b/src/nvim/testdir/test_filetype.vim @@ -192,6 +192,7 @@ let s:filename_checks = { \ 'gdb': ['.gdbinit'], \ 'gdmo': ['file.mo', 'file.gdmo'], \ 'gedcom': ['file.ged', 'lltxxxxx.txt', '/tmp/lltmp', '/tmp/lltmp-file', 'any/tmp/lltmp', 'any/tmp/lltmp-file'], + \ 'gemtext': ['file.gmi', 'file.gemini'], \ 'gift': ['file.gift'], \ 'gitcommit': ['COMMIT_EDITMSG', 'MERGE_MSG', 'TAG_EDITMSG'], \ 'gitconfig': ['file.git/config', '.gitconfig', '.gitmodules', 'file.git/modules//config', '/.config/git/config', '/etc/gitconfig', '/etc/gitconfig.d/file', '/.gitconfig.d/file', 'any/.config/git/config', 'any/.gitconfig.d/file', 'some.git/config', 'some.git/modules/any/config'], @@ -260,6 +261,7 @@ let s:filename_checks = { \ 'jovial': ['file.jov', 'file.j73', 'file.jovial'], \ 'jproperties': ['file.properties', 'file.properties_xx', 'file.properties_xx_xx', 'some.properties_xx_xx_file'], \ 'json': ['file.json', 'file.jsonp', 'file.json-patch', 'file.webmanifest', 'Pipfile.lock', 'file.ipynb'], + \ 'jsonc': ['file.jsonc'], \ 'jsp': ['file.jsp'], \ 'kconfig': ['Kconfig', 'Kconfig.debug', 'Kconfig.file'], \ 'kivy': ['file.kv'], diff --git a/src/nvim/testdir/test_swap.vim b/src/nvim/testdir/test_swap.vim index f27920d20f..3c191cd7c7 100644 --- a/src/nvim/testdir/test_swap.vim +++ b/src/nvim/testdir/test_swap.vim @@ -319,6 +319,7 @@ func Test_swap_prompt_splitwin() let buf = RunVimInTerminal('', {'rows': 20}) call term_sendkeys(buf, ":set nomore\n") call term_sendkeys(buf, ":set noruler\n") + call term_sendkeys(buf, ":split Xfile1\n") call term_wait(buf) call WaitForAssert({-> assert_match('^\[O\]pen Read-Only, (E)dit anyway, (R)ecover, (Q)uit, (A)bort: $', term_getline(buf, 20))}) @@ -330,8 +331,19 @@ func Test_swap_prompt_splitwin() call term_wait(buf) call WaitForAssert({-> assert_match('^1$', term_getline(buf, 20))}) call StopVimInTerminal(buf) + + " This caused Vim to crash when typing "q". + " TODO: it does not actually reproduce the crash. + call writefile(['au BufAdd * set virtualedit=all'], 'Xvimrc') + + let buf = RunVimInTerminal('-u Xvimrc Xfile1', {'rows': 20, 'wait_for_ruler': 0}) + call TermWait(buf) + call WaitForAssert({-> assert_match('^\[O\]pen Read-Only, (E)dit anyway, (R)ecover, (Q)uit, (A)bort:', term_getline(buf, 20))}) + call term_sendkeys(buf, "q") + %bwipe! call delete('Xfile1') + call delete('Xvimrc') endfunc func Test_swap_symlink() diff --git a/src/nvim/testdir/test_visual.vim b/src/nvim/testdir/test_visual.vim index b7c5717bd2..9c62bdb16e 100644 --- a/src/nvim/testdir/test_visual.vim +++ b/src/nvim/testdir/test_visual.vim @@ -2,6 +2,7 @@ source shared.vim source check.vim +source screendump.vim func Test_block_shift_multibyte() " Uses double-wide character. @@ -1082,5 +1083,25 @@ func Test_visual_put_blockedit_zy_and_zp() bw! endfunc +func Test_visual_block_with_virtualedit() + CheckScreendump + + let lines =<< trim END + call setline(1, ['aaaaaa', 'bbbb', 'cc']) + set virtualedit=block + normal G + END + call writefile(lines, 'XTest_block') + + let buf = RunVimInTerminal('-S XTest_block', {'rows': 8, 'cols': 50}) + call term_sendkeys(buf, "\<C-V>gg$") + call VerifyScreenDump(buf, 'Test_visual_block_with_virtualedit', {}) + + " clean up + call term_sendkeys(buf, "\<Esc>") + call StopVimInTerminal(buf) + call delete('XTest_beval') +endfunc + " vim: shiftwidth=2 sts=2 expandtab |