From 429c6d2d4ff2c962d536974090810eecf1f958fb Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sat, 20 Mar 2021 22:11:48 -0400 Subject: [PATCH 1/4] vim-patch:8.2.2624: atom files not recognized MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Problem: Atom files not recognized. Solution: Recognize .atom as XML. (Kivin Locke, closes vim/vim#7986) https://github.com/vim/vim/commit/74b99f6ab6e0265ebee4ed496845f28e0904318d N/A patches for version.c: vim-patch:8.2.2622: GTK: error when starting up and -geometry is given Problem: GTK: error when starting up and -geometry is given. (Dominique Pellé) Solution: Use another function to get the monitor if the window has not been created yet. (closes vim/vim#7978) https://github.com/vim/vim/commit/a555e6fcb6ec97b5ab30b20a340b228f4d820f14 vim-patch:8.2.2626: GTK3: error when starting up and -geometry is given Problem: GTK3: error when starting up and -geometry is given. (Dominique Pellé) Solution: Use another function to get the monitor if the window has not been created yet. (closes vim/vim#7978) https://github.com/vim/vim/commit/240014321b0aa5d6eb00a70865fa9935fd888d60 --- runtime/filetype.vim | 3 +++ src/nvim/testdir/test_filetype.vim | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/runtime/filetype.vim b/runtime/filetype.vim index 4130db2534..e0ebf5d528 100644 --- a/runtime/filetype.vim +++ b/runtime/filetype.vim @@ -164,6 +164,9 @@ au BufNewFile,BufRead *.mar setf vmasm " Atlas au BufNewFile,BufRead *.atl,*.as setf atlas +" Atom is based on XML +au BufNewFile,BufRead *.atom setf xml + " Autoit v3 au BufNewFile,BufRead *.au3 setf autoit diff --git a/src/nvim/testdir/test_filetype.vim b/src/nvim/testdir/test_filetype.vim index 76e5de7df9..d8fc060d1b 100644 --- a/src/nvim/testdir/test_filetype.vim +++ b/src/nvim/testdir/test_filetype.vim @@ -521,7 +521,7 @@ let s:filename_checks = { \ 'xhtml': ['file.xhtml', 'file.xht'], \ 'xinetd': ['/etc/xinetd.conf'], \ 'xmath': ['file.msc', 'file.msf'], - \ 'xml': ['/etc/blkid.tab', '/etc/blkid.tab.old', 'file.xmi', 'file.csproj', 'file.csproj.user', 'file.ui', 'file.tpm', '/etc/xdg/menus/file.menu', 'fglrxrc', 'file.xlf', 'file.xliff', 'file.xul', 'file.wsdl'], + \ 'xml': ['/etc/blkid.tab', '/etc/blkid.tab.old', 'file.xmi', 'file.csproj', 'file.csproj.user', 'file.ui', 'file.tpm', '/etc/xdg/menus/file.menu', 'fglrxrc', 'file.xlf', 'file.xliff', 'file.xul', 'file.wsdl', 'file.wpl', 'any/etc/blkid.tab', 'any/etc/blkid.tab.old', 'any/etc/xdg/menus/file.menu', 'file.atom'], \ 'xmodmap': ['anyXmodmap'], \ 'xf86conf': ['xorg.conf', 'xorg.conf-4'], \ 'xpm2': ['file.xpm2'], From 0bf9f10da08d4eaf3e7957136a6bfb9e505720b8 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sat, 20 Mar 2021 22:16:58 -0400 Subject: [PATCH 2/4] vim-patch:8.2.2625: rss files not recognized Problem: Rss files not recognized. Solution: Recognize .rss as XML. (Kivin Locke, closes vim/vim#7987) https://github.com/vim/vim/commit/af125866db46405fdaf99ac4e43b630d196a4aa4 --- runtime/filetype.vim | 3 +++ src/nvim/testdir/test_filetype.vim | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/runtime/filetype.vim b/runtime/filetype.vim index e0ebf5d528..36352db533 100644 --- a/runtime/filetype.vim +++ b/runtime/filetype.vim @@ -1400,6 +1400,9 @@ else au BufNewFile,BufRead *.rmd,*.smd setf rmd endif +" RSS looks like XML +au BufNewFile,BufRead *.rss setf xml + " R reStructuredText file if has("fname_case") au BufNewFile,BufRead *.Rrst,*.rrst,*.Srst,*.srst setf rrst diff --git a/src/nvim/testdir/test_filetype.vim b/src/nvim/testdir/test_filetype.vim index d8fc060d1b..44b8479621 100644 --- a/src/nvim/testdir/test_filetype.vim +++ b/src/nvim/testdir/test_filetype.vim @@ -521,7 +521,7 @@ let s:filename_checks = { \ 'xhtml': ['file.xhtml', 'file.xht'], \ 'xinetd': ['/etc/xinetd.conf'], \ 'xmath': ['file.msc', 'file.msf'], - \ 'xml': ['/etc/blkid.tab', '/etc/blkid.tab.old', 'file.xmi', 'file.csproj', 'file.csproj.user', 'file.ui', 'file.tpm', '/etc/xdg/menus/file.menu', 'fglrxrc', 'file.xlf', 'file.xliff', 'file.xul', 'file.wsdl', 'file.wpl', 'any/etc/blkid.tab', 'any/etc/blkid.tab.old', 'any/etc/xdg/menus/file.menu', 'file.atom'], + \ 'xml': ['/etc/blkid.tab', '/etc/blkid.tab.old', 'file.xmi', 'file.csproj', 'file.csproj.user', 'file.ui', 'file.tpm', '/etc/xdg/menus/file.menu', 'fglrxrc', 'file.xlf', 'file.xliff', 'file.xul', 'file.wsdl', 'file.wpl', 'any/etc/blkid.tab', 'any/etc/blkid.tab.old', 'any/etc/xdg/menus/file.menu', 'file.atom', 'file.rss'], \ 'xmodmap': ['anyXmodmap'], \ 'xf86conf': ['xorg.conf', 'xorg.conf-4'], \ 'xpm2': ['file.xpm2'], From 749a8b6be767ee3e4dfd83af72973b386ac5ead1 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sat, 20 Mar 2021 23:18:40 -0400 Subject: [PATCH 3/4] vim-patch:8.2.2631: commands from winrestcmd() do not always work properly Problem: Commands from winrestcmd() do not always work properly. (Leonid V. Fedorenchik) Solution: Repeat the size commands twice. (closes vim/vim#7988) https://github.com/vim/vim/commit/a0c8aea479ca055ce43ba2984a9933f6c48e6161 --- src/nvim/eval/funcs.c | 20 +++++++++++++------- src/nvim/testdir/test_window_cmd.vim | 17 +++++++++++++++-- 2 files changed, 28 insertions(+), 9 deletions(-) diff --git a/src/nvim/eval/funcs.c b/src/nvim/eval/funcs.c index 9edf5c8f7e..6304a3d191 100644 --- a/src/nvim/eval/funcs.c +++ b/src/nvim/eval/funcs.c @@ -11378,17 +11378,23 @@ static void f_winnr(typval_T *argvars, typval_T *rettv, FunPtr fptr) */ static void f_winrestcmd(typval_T *argvars, typval_T *rettv, FunPtr fptr) { - int winnr = 1; garray_T ga; char_u buf[50]; ga_init(&ga, (int)sizeof(char), 70); - FOR_ALL_WINDOWS_IN_TAB(wp, curtab) { - sprintf((char *)buf, "%dresize %d|", winnr, wp->w_height); - ga_concat(&ga, buf); - sprintf((char *)buf, "vert %dresize %d|", winnr, wp->w_width); - ga_concat(&ga, buf); - ++winnr; + + // Do this twice to handle some window layouts properly. + for (int i = 0; i < 2; i++) { + int winnr = 1; + FOR_ALL_WINDOWS_IN_TAB(wp, curtab) { + snprintf((char *)buf, sizeof(buf), "%dresize %d|", winnr, + wp->w_height); + ga_concat(&ga, buf); + snprintf((char *)buf, sizeof(buf), "vert %dresize %d|", winnr, + wp->w_width); + ga_concat(&ga, buf); + winnr++; + } } ga_append(&ga, NUL); diff --git a/src/nvim/testdir/test_window_cmd.vim b/src/nvim/testdir/test_window_cmd.vim index 86682cca4f..a522705238 100644 --- a/src/nvim/testdir/test_window_cmd.vim +++ b/src/nvim/testdir/test_window_cmd.vim @@ -550,16 +550,29 @@ endfunc func Test_winrestcmd() 2split 3vsplit - let a = winrestcmd() + let restcmd = winrestcmd() call assert_equal(2, winheight(0)) call assert_equal(3, winwidth(0)) wincmd = call assert_notequal(2, winheight(0)) call assert_notequal(3, winwidth(0)) - exe a + exe restcmd call assert_equal(2, winheight(0)) call assert_equal(3, winwidth(0)) only + + wincmd v + wincmd s + wincmd v + redraw + let restcmd = winrestcmd() + wincmd _ + wincmd | + exe restcmd + redraw + call assert_equal(restcmd, winrestcmd()) + + only endfunc function! Fun_RenewFile() From c620ca4cc2f5c0b3cebde2e172ed1682b06f4495 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sun, 21 Mar 2021 10:27:59 -0400 Subject: [PATCH 4/4] vim-patch:8.2.2634: 'tagfunc' does not indicate using a pattern Problem: 'tagfunc' does not indicate using a pattern. Solution: Add the "r" flag. (Andy Massimino, closes vim/vim#7982) https://github.com/vim/vim/commit/f90c855c71863296859780f7b4e0386e96f1c465 --- runtime/doc/tagsrch.txt | 14 ++++++++++---- src/nvim/tag.c | 7 ++++--- src/nvim/testdir/test_tagfunc.vim | 14 +++++++++++++- 3 files changed, 27 insertions(+), 8 deletions(-) diff --git a/runtime/doc/tagsrch.txt b/runtime/doc/tagsrch.txt index 23db809543..a8848b103e 100644 --- a/runtime/doc/tagsrch.txt +++ b/runtime/doc/tagsrch.txt @@ -847,19 +847,25 @@ like |CTRL-]|. The function used for generating the taglist is specified by setting the 'tagfunc' option. The function will be called with three arguments: - a:pattern The tag identifier used during the tag search. - a:flags List of flags to control the function behavior. + a:pattern The tag identifier or pattern used during the tag search. + a:flags String containing flags to control the function behavior. a:info Dict containing the following entries: buf_ffname Full filename which can be used for priority. user_data Custom data String, if stored in the tag stack previously by tagfunc. -Currently two flags may be passed to the tag function: +Currently up to three flags may be passed to the tag function: 'c' The function was invoked by a normal command being processed (mnemonic: the tag function may use the context around the cursor to perform a better job of generating the tag list.) 'i' In Insert mode, the user was completing a tag (with - |i_CTRL-X_CTRL-]|). + |i_CTRL-X_CTRL-]| or 'completeopt' contains `t`). + 'r' The first argument to tagfunc should be interpreted as a + |pattern| (see |tag-regexp|), such as when using: > + :tag /pat +< It is also given when completing in insert mode. + If this flag is not present, the argument is usually taken + literally as the full tag name. Note that when 'tagfunc' is set, the priority of the tags described in |tag-priority| does not apply. Instead, the priority is exactly as the diff --git a/src/nvim/tag.c b/src/nvim/tag.c index 4ea298fba9..8d9ae68985 100644 --- a/src/nvim/tag.c +++ b/src/nvim/tag.c @@ -1141,7 +1141,7 @@ static int find_tagfunc_tags( int result = FAIL; typval_T args[4]; typval_T rettv; - char_u flagString[3]; + char_u flagString[4]; dict_T *d; taggy_T *tag = &curwin->w_tagstack[curwin->w_tagstackidx]; @@ -1170,9 +1170,10 @@ static int find_tagfunc_tags( args[3].v_type = VAR_UNKNOWN; vim_snprintf((char *)flagString, sizeof(flagString), - "%s%s", + "%s%s%s", g_tag_at_cursor ? "c": "", - flags & TAG_INS_COMP ? "i": ""); + flags & TAG_INS_COMP ? "i": "", + flags & TAG_REGEXP ? "r": ""); save_pos = curwin->w_cursor; result = call_vim_function(curbuf->b_p_tfu, 3, args, &rettv); diff --git a/src/nvim/testdir/test_tagfunc.vim b/src/nvim/testdir/test_tagfunc.vim index 242aa3a235..bb465bafb7 100644 --- a/src/nvim/testdir/test_tagfunc.vim +++ b/src/nvim/testdir/test_tagfunc.vim @@ -43,12 +43,24 @@ func Test_tagfunc() call assert_equal('one', g:tagfunc_args[0]) call assert_equal('c', g:tagfunc_args[1]) + let g:tagfunc_args=[] + execute "tag /foo$" + call assert_equal('foo$', g:tagfunc_args[0]) + call assert_equal('r', g:tagfunc_args[1]) + set cpt=t let g:tagfunc_args=[] execute "normal! i\\" - call assert_equal('ci', g:tagfunc_args[1]) + call assert_equal('\<\k\k', g:tagfunc_args[0]) + call assert_equal('cir', g:tagfunc_args[1]) call assert_equal('nothing1', getline('.')[0:7]) + let g:tagfunc_args=[] + execute "normal! ono\\\" + call assert_equal('\