Merge pull request #14981 from janlazo/vim-8.2.3081

vim-patch:8.2.{3081,3082,3085,3087,3088,3093,3094,3097,3098}
This commit is contained in:
Jan Edmund Lazo 2021-07-04 11:00:48 -04:00 committed by GitHub
commit 18bfcfe77f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 60 additions and 2 deletions

View File

@ -646,6 +646,9 @@ au BufNewFile,BufRead *.mo,*.gdmo setf gdmo
" Gedcom
au BufNewFile,BufRead *.ged,lltxxxxx.txt setf gedcom
" Gemtext
au BufNewFile,BufRead *.gmi,*.gemini setf gemtext
" Gift (Moodle)
autocmd BufRead,BufNewFile *.gift setf gift
@ -864,6 +867,9 @@ au BufNewFile,BufRead *.json-patch setf json
" Jupyter Notebook is also json
au BufNewFile,BufRead *.ipynb setf json
" JSONC
au BufNewFile,BufRead *.jsonc setf jsonc
" Kixtart
au BufNewFile,BufRead *.kix setf kix

View File

@ -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;
}

View File

@ -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) {

View File

@ -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)

View File

@ -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'],

View File

@ -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()

View File

@ -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