diff --git a/.github/CODEOWNERS_vim b/.github/CODEOWNERS_vim index a75f00d891..cd648004e3 100644 --- a/.github/CODEOWNERS_vim +++ b/.github/CODEOWNERS_vim @@ -124,6 +124,9 @@ runtime/ftplugin/cs.vim @nickspoons runtime/ftplugin/csh.vim @dkearns runtime/ftplugin/css.vim @dkearns runtime/ftplugin/cucumber.vim @tpope +runtime/ftplugin/debchangelog.vim @jamessan +runtime/ftplugin/debcontrol.vim @jamessan +runtime/ftplugin/debsources.vim @jamessan runtime/ftplugin/desktop.vim @e-kwsm runtime/ftplugin/dosbatch.vim @mrdubya runtime/ftplugin/eiffel.vim @dkearns @@ -163,6 +166,8 @@ runtime/ftplugin/ishd.vim @dkearns runtime/ftplugin/j.vim @glts runtime/ftplugin/javascript.vim @dkearns runtime/ftplugin/javascriptreact.vim @dkearns +runtime/ftplugin/json.vim @dbarnett +runtime/ftplugin/json5.vim @dkearns runtime/ftplugin/jsonc.vim @izhakjakov runtime/ftplugin/julia.vim @carlobaldassi runtime/ftplugin/kconfig.vim @chrisbra @@ -355,6 +360,12 @@ runtime/syntax/d.vim @JesseKPhillips runtime/syntax/dart.vim @pr3d4t0r runtime/syntax/datascript.vim @dpelle runtime/syntax/dcl.vim @cecamp +runtime/syntax/deb822sources.vim @jamessan +runtime/syntax/debchangelog.vim @jamessan +runtime/syntax/debcontrol.vim @jamessan +runtime/syntax/debcopyright.vim @jamessan +runtime/syntax/debsources.vim @jamessan +runtime/syntax/dep3patch.vim @jamessan runtime/syntax/desktop.vim @e-kwsm runtime/syntax/dosbatch.vim @mrdubya runtime/syntax/dosini.vim @xuhdev @@ -477,6 +488,7 @@ runtime/syntax/scss.vim @tpope runtime/syntax/sdoc.vim @gpanders runtime/syntax/sed.vim @dkearns runtime/syntax/sh.vim @cecamp +runtime/syntax/shared/debversions.vim @jamessan runtime/syntax/sm.vim @cecamp runtime/syntax/solidity.vim @cothi runtime/syntax/spec.vim @ignatenkobrain diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 9441bf385a..d41773721a 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -9,10 +9,7 @@ body: value: | Thanks for reporting issues of MacVim! - If you want to report a security issue, instead of reporting it here - you can alternatively disclose it on - [huntr.dev](https://huntr.dev/bounties/disclose/?utm_campaign=macvim-dev%2Fmacvim&utm_medium=social&utm_source=github&target=https%3A%2F%2Fgithub.com%2Fmacvim-dev%2Fmacvim). - They have rewards in the form of money, swag and CVEs. + If you want to report a security issue, instead of reporting it here publicly, please disclose it using the steps listed at https://github.com/macvim-dev/macvim/security/policy. To make it easier for us to help you please enter detailed information below. - type: textarea diff --git a/SECURITY.md b/SECURITY.md index 7d9c77d275..7d1e0166c9 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -2,7 +2,9 @@ ## Reporting a vulnerability -If you want to report a security issue, please use [huntr.dev](https://huntr.dev/bounties/disclose?target=https%3A%2F%2Fgithub.com%2Fvim%2Fvim) to privately disclose the issue to us. -They also have rewards in the form of money, swag and CVEs. +If you want to report a security issue, please privately disclose the issue to the vim-security mailing list +vim-security@googlegroups.com + +This is a private list, read only by the maintainers, but anybody can post, after moderation. **Please don't publicly disclose the issue until it has been addressed by us.** diff --git a/runtime/autoload/dist/script.vim b/runtime/autoload/dist/script.vim index fca5dcdbe6..1685093d54 100644 --- a/runtime/autoload/dist/script.vim +++ b/runtime/autoload/dist/script.vim @@ -217,6 +217,14 @@ export def Exe2filetype(name: string, line1: string): string elseif name =~ '^\%(rexx\|regina\)\>' return 'rexx' + # Janet + elseif name =~ '^janet\>' + return 'janet' + + # Dart + elseif name =~ '^dart\>' + return 'dart' + endif return '' @@ -361,7 +369,7 @@ def DetectFromText(line1: string) # Strace # inaccurate fast match first, then use accurate slow match - elseif (line1 =~ 'execve(' && line1 =~ '^[0-9:.]* *execve(') + elseif (line1 =~ 'execve(' && line1 =~ '^[0-9:. ]*execve(') || line1 =~ '^__libc_start_main' setl ft=strace diff --git a/runtime/autoload/dist/vim.vim b/runtime/autoload/dist/vim.vim new file mode 100644 index 0000000000..021244c93b --- /dev/null +++ b/runtime/autoload/dist/vim.vim @@ -0,0 +1,32 @@ +" Vim runtime support library, +" runs the vim9 script version or legacy script version +" on demand (mostly for Neovim compatability) +" +" Maintainer: The Vim Project +" Last Change: 2023 Nov 04 + + +" enable the zip and gzip plugin by default, if not set +if !exists('g:zip_exec') + let g:zip_exec = 1 +endif + +if !exists('g:gzip_exec') + let g:gzip_exec = 1 +endif + +if !has('vim9script') + function dist#vim#IsSafeExecutable(filetype, executable) + let cwd = getcwd() + return get(g:, a:filetype .. '_exec', get(g:, 'plugin_exec', 0)) && + \ (fnamemodify(exepath(a:executable), ':p:h') !=# cwd + \ || (split($PATH, has('win32') ? ';' : ':')->index(cwd) != -1 && + \ cwd != '.')) + endfunction + + finish +endif + +def dist#vim#IsSafeExecutable(filetype: string, executable: string): bool + return dist#vim9#IsSafeExecutable(filetype, executable) +enddef diff --git a/runtime/autoload/dist/vim9.vim b/runtime/autoload/dist/vim9.vim new file mode 100644 index 0000000000..807140da7c --- /dev/null +++ b/runtime/autoload/dist/vim9.vim @@ -0,0 +1,17 @@ +vim9script + +# Vim runtime support library +# +# Maintainer: The Vim Project +# Last Change: 2023 Oct 25 + +export def IsSafeExecutable(filetype: string, executable: string): bool + var cwd = getcwd() + return get(g:, filetype .. '_exec', get(g:, 'plugin_exec', 0)) + && (fnamemodify(exepath(executable), ':p:h') !=# cwd + || (split($PATH, has('win32') ? ';' : ':')->index(cwd) != -1 + && cwd != '.')) +enddef + +# Uncomment this line to check for compilation errors early +# defcompile diff --git a/runtime/autoload/gzip.vim b/runtime/autoload/gzip.vim index 6d0bb13401..26b1cda034 100644 --- a/runtime/autoload/gzip.vim +++ b/runtime/autoload/gzip.vim @@ -11,10 +11,7 @@ fun s:check(cmd) let name = substitute(a:cmd, '\(\S*\).*', '\1', '') if !exists("s:have_" . name) " safety check, don't execute anything from the current directory - let s:tmp_cwd = getcwd() - let f = (fnamemodify(exepath(name), ":p:h") !=# s:tmp_cwd - \ || (index(split($PATH,has("win32")? ';' : ':'), s:tmp_cwd) != -1 && s:tmp_cwd != '.')) - unlet s:tmp_cwd + let f = dist#vim#IsSafeExecutable('gzip', name) if !f echoerr "Warning: NOT executing " .. name .. " from current directory!" endif diff --git a/runtime/autoload/netrw.vim b/runtime/autoload/netrw.vim index 33a2fdd897..d2df846662 100644 --- a/runtime/autoload/netrw.vim +++ b/runtime/autoload/netrw.vim @@ -1166,7 +1166,6 @@ fun! netrw#Explore(indx,dosplit,style,...) 2match none if exists("s:explore_match") | unlet s:explore_match | endif if exists("s:explore_prvdir") | unlet s:explore_prvdir | endif - echo " " " call Decho("cleared explore match list",'~'.expand("")) endif @@ -5730,8 +5729,6 @@ fun! s:NetrwClearExplore() if exists("w:netrw_explore_list") |unlet w:netrw_explore_list |endif if exists("w:netrw_explore_bufnr") |unlet w:netrw_explore_bufnr |endif " redraw! - echo " " - echo " " " call Dret("s:NetrwClearExplore") endfun diff --git a/runtime/autoload/tar.vim b/runtime/autoload/tar.vim index e495e8262a..52369a42c1 100644 --- a/runtime/autoload/tar.vim +++ b/runtime/autoload/tar.vim @@ -1,7 +1,7 @@ " tar.vim: Handles browsing tarfiles " AUTOLOAD PORTION -" Date: Jan 07, 2020 -" Version: 32 +" Date: Nov 05, 2023 +" Version: 32a (with modifications from the Vim Project) " Maintainer: Charles E Campbell " License: Vim License (see vim's :help license) " @@ -22,7 +22,7 @@ if &cp || exists("g:loaded_tar") finish endif -let g:loaded_tar= "v32" +let g:loaded_tar= "v32a" if v:version < 702 echohl WarningMsg echo "***warning*** this version of tar needs vim 7.2" @@ -208,7 +208,16 @@ fun! tar#Browse(tarfile) " call Dret("tar#Browse : a:tarfile<".a:tarfile.">") return endif - if line("$") == curlast || ( line("$") == (curlast + 1) && getline("$") =~# '\c\%(warning\|error\|inappropriate\|unrecognized\)') + " If there was an error message, the last line probably matches some keywords but + " should also contain whitespace for readability. Make sure not to match a + " filename that contains the keyword (error/warning/unrecognized/inappropriate, etc) + " + " FIXME:is this actually necessary? In case of an error, we should probably + " have noticed in the if statement above since tar should have exited + " with a non-zero exit code. + if line("$") == curlast || ( line("$") == (curlast + 1) && + \ getline("$") =~# '\c\<\%(warning\|error\|inappropriate\|unrecognized\)\>' && + \ getline("$") =~ '\s' ) redraw! echohl WarningMsg | echo "***warning*** (tar#Browse) ".a:tarfile." doesn't appear to be a tar file" | echohl None keepj sil! %d diff --git a/runtime/autoload/zip.vim b/runtime/autoload/zip.vim index 8b39c91c3a..e61293c357 100644 --- a/runtime/autoload/zip.vim +++ b/runtime/autoload/zip.vim @@ -57,14 +57,10 @@ if !exists("g:zip_extractcmd") let g:zip_extractcmd= g:zip_unzipcmd endif -let s:tmp_cwd = getcwd() -if (fnamemodify(exepath(g:zip_unzipcmd), ":p:h") ==# getcwd() - \ && (index(split($PATH,has("win32")? ';' : ':'), s:tmp_cwd) == -1 || s:tmp_cwd == '.')) - unlet s:tmp_cwd +if !dist#vim#IsSafeExecutable('zip', g:zip_unzipcmd) echoerr "Warning: NOT executing " .. g:zip_unzipcmd .. " from current directory!" finish endif -unlet s:tmp_cwd " ---------------- " Functions: {{{1 diff --git a/runtime/doc/Makefile b/runtime/doc/Makefile index 932360eb2c..0445511b6c 100644 --- a/runtime/doc/Makefile +++ b/runtime/doc/Makefile @@ -13,338 +13,9 @@ VIMEXE = vim # AWK, used for "make html". Comment this out if the include gives problems. include ../../src/auto/config.mk -DOCS = \ - arabic.txt \ - autocmd.txt \ - builtin.txt \ - change.txt \ - channel.txt \ - cmdline.txt \ - debug.txt \ - debugger.txt \ - develop.txt \ - diff.txt \ - digraph.txt \ - editing.txt \ - eval.txt \ - farsi.txt \ - filetype.txt \ - fold.txt \ - ft_ada.txt \ - ft_context.txt \ - ft_mp.txt \ - ft_ps1.txt \ - ft_raku.txt \ - ft_rust.txt \ - ft_sql.txt \ - gui.txt \ - gui_mac.txt \ - gui_w32.txt \ - gui_x11.txt \ - hangulin.txt \ - hebrew.txt \ - help.txt \ - helphelp.txt \ - howto.txt \ - if_cscop.txt \ - if_lua.txt \ - if_mzsch.txt \ - if_ole.txt \ - if_perl.txt \ - if_pyth.txt \ - if_ruby.txt \ - if_sniff.txt \ - if_tcl.txt \ - indent.txt \ - index.txt \ - insert.txt \ - intro.txt \ - map.txt \ - mbyte.txt \ - message.txt \ - mlang.txt \ - motion.txt \ - netbeans.txt \ - options.txt \ - os_390.txt \ - os_amiga.txt \ - os_beos.txt \ - os_dos.txt \ - os_haiku.txt \ - os_mac.txt \ - os_mint.txt \ - os_msdos.txt \ - os_os2.txt \ - os_qnx.txt \ - os_risc.txt \ - os_unix.txt \ - os_vms.txt \ - os_win32.txt \ - pattern.txt \ - pi_getscript.txt \ - pi_gzip.txt \ - pi_logipat.txt \ - pi_netrw.txt \ - pi_paren.txt \ - pi_spec.txt \ - pi_tar.txt \ - pi_vimball.txt \ - pi_zip.txt \ - popup.txt \ - print.txt \ - quickfix.txt \ - quickref.txt \ - quotes.txt \ - recover.txt \ - remote.txt \ - repeat.txt \ - rileft.txt \ - russian.txt \ - scroll.txt \ - sign.txt \ - spell.txt \ - sponsor.txt \ - starting.txt \ - syntax.txt \ - tabpage.txt \ - tagsrch.txt \ - term.txt \ - terminal.txt \ - testing.txt \ - textprop.txt \ - tips.txt \ - todo.txt \ - uganda.txt \ - undo.txt \ - userfunc.txt \ - usr_01.txt \ - usr_02.txt \ - usr_03.txt \ - usr_04.txt \ - usr_05.txt \ - usr_06.txt \ - usr_07.txt \ - usr_08.txt \ - usr_09.txt \ - usr_10.txt \ - usr_11.txt \ - usr_12.txt \ - usr_20.txt \ - usr_21.txt \ - usr_22.txt \ - usr_23.txt \ - usr_24.txt \ - usr_25.txt \ - usr_26.txt \ - usr_27.txt \ - usr_28.txt \ - usr_29.txt \ - usr_30.txt \ - usr_31.txt \ - usr_32.txt \ - usr_40.txt \ - usr_41.txt \ - usr_42.txt \ - usr_43.txt \ - usr_44.txt \ - usr_45.txt \ - usr_50.txt \ - usr_51.txt \ - usr_52.txt \ - usr_90.txt \ - usr_toc.txt \ - various.txt \ - version4.txt \ - version5.txt \ - version6.txt \ - version7.txt \ - version8.txt \ - version9.txt \ - vi_diff.txt \ - vim9.txt \ - vim9class.txt \ - visual.txt \ - windows.txt \ - workshop.txt - -HTMLS = \ - arabic.html \ - autocmd.html \ - builtin.html \ - change.html \ - channel.html \ - cmdline.html \ - debug.html \ - debugger.html \ - develop.html \ - diff.html \ - digraph.html \ - editing.html \ - eval.html \ - farsi.html \ - filetype.html \ - fold.html \ - ft_ada.html \ - ft_context.html \ - ft_mp.html \ - ft_ps1.html \ - ft_raku.html \ - ft_rust.html \ - ft_sql.html \ - gui.html \ - gui_w32.html \ - gui_x11.html \ - hangulin.html \ - hebrew.html \ - helphelp.html \ - howto.html \ - if_cscop.html \ - if_lua.html \ - if_mzsch.html \ - if_ole.html \ - if_perl.html \ - if_pyth.html \ - if_ruby.html \ - if_sniff.html \ - if_tcl.html \ - indent.html \ - index.html \ - insert.html \ - intro.html \ - map.html \ - mbyte.html \ - message.html \ - mlang.html \ - motion.html \ - netbeans.html \ - options.html \ - os_390.html \ - os_amiga.html \ - os_beos.html \ - os_dos.html \ - os_haiku.html \ - os_mac.html \ - os_mint.html \ - os_msdos.html \ - os_os2.html \ - os_qnx.html \ - os_risc.html \ - os_unix.html \ - os_vms.html \ - os_win32.html \ - pattern.html \ - pi_getscript.html \ - pi_gzip.html \ - pi_logipat.html \ - pi_netrw.html \ - pi_paren.html \ - pi_spec.html \ - pi_tar.html \ - pi_vimball.html \ - pi_zip.html \ - popup.html \ - print.html \ - quickfix.html \ - quickref.html \ - quotes.html \ - recover.html \ - remote.html \ - repeat.html \ - rileft.html \ - russian.html \ - scroll.html \ - sign.html \ - spell.html \ - sponsor.html \ - starting.html \ - syntax.html \ - tabpage.html \ - tagsrch.html \ - term.html \ - terminal.html \ - testing.html \ - textprop.html \ - tips.html \ - todo.html \ - uganda.html \ - undo.html \ - userfunc.html \ - usr_01.html \ - usr_02.html \ - usr_03.html \ - usr_04.html \ - usr_05.html \ - usr_06.html \ - usr_07.html \ - usr_08.html \ - usr_09.html \ - usr_10.html \ - usr_11.html \ - usr_12.html \ - usr_20.html \ - usr_21.html \ - usr_22.html \ - usr_23.html \ - usr_24.html \ - usr_25.html \ - usr_26.html \ - usr_27.html \ - usr_28.html \ - usr_29.html \ - usr_30.html \ - usr_31.html \ - usr_32.html \ - usr_40.html \ - usr_41.html \ - usr_42.html \ - usr_43.html \ - usr_44.html \ - usr_45.html \ - usr_50.html \ - usr_51.html \ - usr_52.html \ - usr_90.html \ - usr_toc.html \ - various.html \ - version4.html \ - version5.html \ - version6.html \ - version7.html \ - version8.html \ - version9.html \ - vi_diff.html \ - vimindex.html \ - vim9.html \ - vim9class.html \ - visual.html \ - windows.html \ - workshop.html - -CONVERTED = \ - vim-fr.UTF-8.1 \ - evim-fr.UTF-8.1 \ - vimdiff-fr.UTF-8.1 \ - vimtutor-fr.UTF-8.1 \ - xxd-fr.UTF-8.1 \ - vim-it.UTF-8.1 \ - evim-it.UTF-8.1 \ - vimdiff-it.UTF-8.1 \ - vimtutor-it.UTF-8.1 \ - xxd-it.UTF-8.1 \ - vim-pl.UTF-8.1 \ - evim-pl.UTF-8.1 \ - vimdiff-pl.UTF-8.1 \ - vimtutor-pl.UTF-8.1 \ - xxd-pl.UTF-8.1 \ - vim-ru.UTF-8.1 \ - evim-ru.UTF-8.1 \ - vimdiff-ru.UTF-8.1 \ - vimtutor-ru.UTF-8.1 \ - xxd-ru.UTF-8.1 \ - vim-tr.UTF-8.1 \ - evim-tr.UTF-8.1 \ - vimdiff-tr.UTF-8.1 \ - vimtutor-tr.UTF-8.1 +# 17.10.23, added by Restorer +# Common components +include makefile_all.mak .SUFFIXES: .SUFFIXES: .c .o .txt .html @@ -477,6 +148,18 @@ os_win32.txt: # Note that $< works with GNU make while $> works for BSD make. # Is there a solution that works for both?? +vim-da.UTF-8.1: vim-da.1 # 17.10.23, added by Restorer + iconv -f latin1 -t utf-8 $< >$@ + +vimdiff-da.UTF-8.1: vimdiff-da.1 # 17.10.23, added by Restorer + iconv -f latin1 -t utf-8 $< >$@ + +vimtutor-da.UTF-8.1: vimtutor-da.1 # 17.10.23, added by Restorer + iconv -f latin1 -t utf-8 $< >$@ + +vim-de.UTF-8.1: vim-de.1 # 17.10.23, added by Restorer + iconv -f latin1 -t utf-8 $< >$@ + vim-fr.UTF-8.1: vim-fr.1 iconv -f latin1 -t utf-8 $< >$@ diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt index 6b434d0b21..735f92981d 100644 --- a/runtime/doc/builtin.txt +++ b/runtime/doc/builtin.txt @@ -4203,7 +4203,7 @@ getscriptinfo([{opts}]) *getscriptinfo()* Note that this is a copy, the value of script-local variables cannot be changed using this dictionary. - version Vimscript version (|scriptversion|) + version Vim script version (|scriptversion|) Examples: > :echo getscriptinfo({'name': 'myscript'}) diff --git a/runtime/doc/digraph.txt b/runtime/doc/digraph.txt index e9bdeb5dd3..624aa27fad 100644 --- a/runtime/doc/digraph.txt +++ b/runtime/doc/digraph.txt @@ -1,4 +1,4 @@ -*digraph.txt* For Vim version 9.0. Last change: 2023 Mar 21 +*digraph.txt* For Vim version 9.0. Last change: 2023 Oct 20 VIM REFERENCE MANUAL by Bram Moolenaar @@ -174,6 +174,13 @@ ROUBLE The rouble sign was added in 2014 as 0x20bd. Vim supports the digraphs =R and =P for this. Note that R= and P= are other characters. +QUADRUPLE PRIME + +The quadruple prime using the digraph 4' was added in 2023. Although it is +not part of RFC 1345, it supplements the existing digraph implementation as +there already exist digraphs for PRIME, DOUBLE PRIME and TRIPLE PRIME using +the 1', 2' and 3' digraphs. + *digraph-table* char digraph hex dec official name ~ ^@ NU 0x00 0 NULL (NUL) @@ -931,6 +938,7 @@ char digraph hex dec official name ~ ′ 1' 2032 8242 PRIME ″ 2' 2033 8243 DOUBLE PRIME ‴ 3' 2034 8244 TRIPLE PRIME +⁗ 4' 2057 8279 QUADRUPLE PRIME ‵ 1" 2035 8245 REVERSED PRIME ‶ 2" 2036 8246 REVERSED DOUBLE PRIME ‷ 3" 2037 8247 REVERSED TRIPLE PRIME diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 8328aefc64..3f67c8110e 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -1,4 +1,4 @@ -*eval.txt* For Vim version 9.0. Last change: 2023 Jun 01 +*eval.txt* For Vim version 9.0. Last change: 2023 Nov 05 VIM REFERENCE MANUAL by Bram Moolenaar @@ -36,6 +36,7 @@ a remark is given. 11. No +eval feature |no-eval-feature| 12. The sandbox |eval-sandbox| 13. Textlock |textlock| +14. Vim script library |vim-script-library| Testing support is documented in |testing.txt|. Profiling is documented at |profiling|. @@ -4813,5 +4814,37 @@ This is not allowed when the textlock is active: - closing a window or quitting Vim - etc. +============================================================================== +14. Vim script library *vim-script-library* + +Vim comes bundled with a Vim script library, that can be used by runtime, +script authors. Currently, it only includes very few functions, but it may +grow over time. + +The functions are available as |Vim9-script| as well as using legacy vim +script (to be used for non Vim 9.0 versions and Neovim). + + *dist#vim* *dist#vim9* +The functions make use of the autoloaded prefix "dist#vim" (for legacy Vim script and +Neovim) and "dist#vim9" for Vim9 script. + +The following functions are available: + +dist#vim#IsSafeExecutable(filetype, executable) ~ +dist#vim9#IsSafeExecutable(filetype:string, executable:string): bool ~ + +This function takes a filetype and an executable and checks whether it is safe +to execute the given executable. For security reasons users may not want to +have Vim execute random executables or may have forbidden to do so for +specific filetypes by setting the "_exec" variable (|plugin_exec|). + +It returns |true| or |false| to indicate whether the plugin should run the given +exectuable. It takes the following arguments: + + argument type ~ + + filetype string + executable string + vim:tw=78:ts=8:noet:ft=help:norl: diff --git a/runtime/doc/if_pyth.txt b/runtime/doc/if_pyth.txt index c0b968e07c..4ea6d13802 100644 --- a/runtime/doc/if_pyth.txt +++ b/runtime/doc/if_pyth.txt @@ -1,4 +1,4 @@ -*if_pyth.txt* For Vim version 9.0. Last change: 2022 Feb 22 +*if_pyth.txt* For Vim version 9.0. Last change: 2023 Oct 25 VIM REFERENCE MANUAL by Paul Moore @@ -524,7 +524,7 @@ The range object methods are: Range object type is available using "Range" attribute of vim module. -Example (assume r is the current range): +Example (assume r is the current range): > # Send all lines in a range to the default printer vim.command("%d,%dhardcopy!" % (r.start+1,r.end+1)) diff --git a/runtime/doc/indent.txt b/runtime/doc/indent.txt index 8cae93ab83..a16c8aca6f 100644 --- a/runtime/doc/indent.txt +++ b/runtime/doc/indent.txt @@ -1236,7 +1236,7 @@ variable. It supports 3 keys, `line_continuation`, `more_in_bracket_block`, and `searchpair_timeout`. `line_continuation` expects a number which will be added to the indent level of a continuation line starting with a backslash, and defaults to -`shiftwidth() * 3`. It also accepts a string, which is evaluated at runtime. +`shiftwidth() * 3` . It also accepts a string, which is evaluated at runtime. `more_in_bracket_block` expects a boolean value; when on, an extra `shiftwidth()` is added inside blocks surrounded with brackets. It defaults to `v:false`. @@ -1244,14 +1244,14 @@ a continuation line starting with a backslash, and defaults to a timeout. Increasing the value might give more accurate results, but also causes the indentation to take more time. It defaults to 100 (milliseconds). -Example of configuration: +Example of configuration: > let g:vim_indent = #{ \ line_continuation: shiftwidth() * 3, \ more_in_bracket_block: v:false, \ searchpair_timeout: 100, \ } - +< *g:vim_indent_cont* This variable is equivalent to `g:vim_indent.line_continuation`. It's supported for backward compatibility. diff --git a/runtime/doc/intro.txt b/runtime/doc/intro.txt index b19c3067cb..f4ddb0876c 100644 --- a/runtime/doc/intro.txt +++ b/runtime/doc/intro.txt @@ -184,7 +184,7 @@ introduce Y2K problems, but those are not really part of Vim itself. ============================================================================== 3. Credits *credits* *author* -Most of Vim was created by Bram Moolenaar |Bram-Moolenaar| +Most of Vim was created by Bram Moolenaar |Bram-Moolenaar|. Parts of the documentation come from several Vi manuals, written by: W.N. Joy @@ -217,7 +217,8 @@ Vim would never have become what it is now, without the help of these people! Bill Foster Athena GUI port (later removed) Google Let Bram work on Vim one day a week Loic Grenie xvim (ideas for multi windows version) - Sven Guckes Vim promoter and previous WWW page maintainer |Sven-Guckes| + Sven Guckes Vim promoter and previous WWW page maintainer + |Sven-Guckes| Darren Hiebert Exuberant ctags Jason Hildebrand GTK+ 2 port Bruce Hunsaker improvements for VMS port diff --git a/runtime/doc/makefile_all.mak b/runtime/doc/makefile_all.mak new file mode 100644 index 0000000000..40a4bfe254 --- /dev/null +++ b/runtime/doc/makefile_all.mak @@ -0,0 +1,340 @@ +# makefile with common components + +DOCS = \ + arabic.txt \ + autocmd.txt \ + builtin.txt \ + change.txt \ + channel.txt \ + cmdline.txt \ + debug.txt \ + debugger.txt \ + develop.txt \ + diff.txt \ + digraph.txt \ + editing.txt \ + eval.txt \ + farsi.txt \ + filetype.txt \ + fold.txt \ + ft_ada.txt \ + ft_context.txt \ + ft_mp.txt \ + ft_ps1.txt \ + ft_raku.txt \ + ft_rust.txt \ + ft_sql.txt \ + gui.txt \ + gui_mac.txt \ + gui_w32.txt \ + gui_x11.txt \ + hangulin.txt \ + hebrew.txt \ + help.txt \ + helphelp.txt \ + howto.txt \ + if_cscop.txt \ + if_lua.txt \ + if_mzsch.txt \ + if_ole.txt \ + if_perl.txt \ + if_pyth.txt \ + if_ruby.txt \ + if_sniff.txt \ + if_tcl.txt \ + indent.txt \ + index.txt \ + insert.txt \ + intro.txt \ + map.txt \ + mbyte.txt \ + message.txt \ + mlang.txt \ + motion.txt \ + netbeans.txt \ + options.txt \ + os_390.txt \ + os_amiga.txt \ + os_beos.txt \ + os_dos.txt \ + os_haiku.txt \ + os_mac.txt \ + os_mint.txt \ + os_msdos.txt \ + os_os2.txt \ + os_qnx.txt \ + os_risc.txt \ + os_unix.txt \ + os_vms.txt \ + os_win32.txt \ + pattern.txt \ + pi_getscript.txt \ + pi_gzip.txt \ + pi_logipat.txt \ + pi_netrw.txt \ + pi_paren.txt \ + pi_spec.txt \ + pi_tar.txt \ + pi_vimball.txt \ + pi_zip.txt \ + popup.txt \ + print.txt \ + quickfix.txt \ + quickref.txt \ + quotes.txt \ + recover.txt \ + remote.txt \ + repeat.txt \ + rileft.txt \ + russian.txt \ + scroll.txt \ + sign.txt \ + spell.txt \ + sponsor.txt \ + starting.txt \ + syntax.txt \ + tabpage.txt \ + tagsrch.txt \ + term.txt \ + terminal.txt \ + testing.txt \ + textprop.txt \ + tips.txt \ + todo.txt \ + uganda.txt \ + undo.txt \ + userfunc.txt \ + usr_01.txt \ + usr_02.txt \ + usr_03.txt \ + usr_04.txt \ + usr_05.txt \ + usr_06.txt \ + usr_07.txt \ + usr_08.txt \ + usr_09.txt \ + usr_10.txt \ + usr_11.txt \ + usr_12.txt \ + usr_20.txt \ + usr_21.txt \ + usr_22.txt \ + usr_23.txt \ + usr_24.txt \ + usr_25.txt \ + usr_26.txt \ + usr_27.txt \ + usr_28.txt \ + usr_29.txt \ + usr_30.txt \ + usr_31.txt \ + usr_32.txt \ + usr_40.txt \ + usr_41.txt \ + usr_42.txt \ + usr_43.txt \ + usr_44.txt \ + usr_45.txt \ + usr_50.txt \ + usr_51.txt \ + usr_52.txt \ + usr_90.txt \ + usr_toc.txt \ + various.txt \ + version4.txt \ + version5.txt \ + version6.txt \ + version7.txt \ + version8.txt \ + version9.txt \ + vi_diff.txt \ + vim9.txt \ + vim9class.txt \ + visual.txt \ + windows.txt \ + workshop.txt + +HTMLS = \ + arabic.html \ + autocmd.html \ + builtin.html \ + change.html \ + channel.html \ + cmdline.html \ + debug.html \ + debugger.html \ + develop.html \ + diff.html \ + digraph.html \ + editing.html \ + eval.html \ + farsi.html \ + filetype.html \ + fold.html \ + ft_ada.html \ + ft_context.html \ + ft_mp.html \ + ft_ps1.html \ + ft_raku.html \ + ft_rust.html \ + ft_sql.html \ + gui.html \ + gui_mac.html \ + gui_w32.html \ + gui_x11.html \ + hangulin.html \ + hebrew.html \ + helphelp.html \ + howto.html \ + if_cscop.html \ + if_lua.html \ + if_mzsch.html \ + if_ole.html \ + if_perl.html \ + if_pyth.html \ + if_ruby.html \ + if_sniff.html \ + if_tcl.html \ + indent.html \ + index.html \ + insert.html \ + intro.html \ + map.html \ + mbyte.html \ + message.html \ + mlang.html \ + motion.html \ + netbeans.html \ + options.html \ + os_390.html \ + os_amiga.html \ + os_beos.html \ + os_dos.html \ + os_haiku.html \ + os_mac.html \ + os_mint.html \ + os_msdos.html \ + os_os2.html \ + os_qnx.html \ + os_risc.html \ + os_unix.html \ + os_vms.html \ + os_win32.html \ + pattern.html \ + pi_getscript.html \ + pi_gzip.html \ + pi_logipat.html \ + pi_netrw.html \ + pi_paren.html \ + pi_spec.html \ + pi_tar.html \ + pi_vimball.html \ + pi_zip.html \ + popup.html \ + print.html \ + quickfix.html \ + quickref.html \ + quotes.html \ + recover.html \ + remote.html \ + repeat.html \ + rileft.html \ + russian.html \ + scroll.html \ + sign.html \ + spell.html \ + sponsor.html \ + starting.html \ + syntax.html \ + tabpage.html \ + tagsrch.html \ + term.html \ + terminal.html \ + testing.html \ + textprop.html \ + tips.html \ + todo.html \ + uganda.html \ + undo.html \ + userfunc.html \ + usr_01.html \ + usr_02.html \ + usr_03.html \ + usr_04.html \ + usr_05.html \ + usr_06.html \ + usr_07.html \ + usr_08.html \ + usr_09.html \ + usr_10.html \ + usr_11.html \ + usr_12.html \ + usr_20.html \ + usr_21.html \ + usr_22.html \ + usr_23.html \ + usr_24.html \ + usr_25.html \ + usr_26.html \ + usr_27.html \ + usr_28.html \ + usr_29.html \ + usr_30.html \ + usr_31.html \ + usr_32.html \ + usr_40.html \ + usr_41.html \ + usr_42.html \ + usr_43.html \ + usr_44.html \ + usr_45.html \ + usr_50.html \ + usr_51.html \ + usr_52.html \ + usr_90.html \ + usr_toc.html \ + various.html \ + version4.html \ + version5.html \ + version6.html \ + version7.html \ + version8.html \ + version9.html \ + vi_diff.html \ + vimindex.html \ + vim9.html \ + vim9class.html \ + visual.html \ + windows.html \ + workshop.html + +CONVERTED = \ + vim-da.UTF-8.1 \ + vimdiff-da.UTF-8.1 \ + vimtutor-da.UTF-8.1 \ + vim-de.UTF-8.1 \ + vim-fr.UTF-8.1 \ + evim-fr.UTF-8.1 \ + vimdiff-fr.UTF-8.1 \ + vimtutor-fr.UTF-8.1 \ + xxd-fr.UTF-8.1 \ + vim-it.UTF-8.1 \ + evim-it.UTF-8.1 \ + vimdiff-it.UTF-8.1 \ + vimtutor-it.UTF-8.1 \ + xxd-it.UTF-8.1 \ + vim-pl.UTF-8.1 \ + evim-pl.UTF-8.1 \ + vimdiff-pl.UTF-8.1 \ + vimtutor-pl.UTF-8.1 \ + xxd-pl.UTF-8.1 \ + vim-ru.UTF-8.1 \ + evim-ru.UTF-8.1 \ + vimdiff-ru.UTF-8.1 \ + vimtutor-ru.UTF-8.1 \ + xxd-ru.UTF-8.1 \ + vim-tr.UTF-8.1 \ + evim-tr.UTF-8.1 \ + vimdiff-tr.UTF-8.1 \ + vimtutor-tr.UTF-8.1 + diff --git a/runtime/doc/makefile_mvc.mak b/runtime/doc/makefile_mvc.mak new file mode 100644 index 0000000000..218aaa67bc --- /dev/null +++ b/runtime/doc/makefile_mvc.mak @@ -0,0 +1,460 @@ +# +# Makefile for the Vim documentation on Windows +# +# 17.11.23, Restorer, + +# Common components +!INCLUDE makefile_all.mak + + +# TODO: to think about what to use instead of awk. PowerShell? +#AWK = + +# +VIMEXE = D:\Programs\Vim\vim90\vim.exe + +# +GETTEXT_PATH = D:\Programs\GetText\bin + +# In case some package like GnuWin32, UnixUtils +# or something similar is installed on the system. +# If the "touch" program is installed on the system, but it is not registered +# in the %PATH% environment variable, then specify the full path to this file. +!IF EXIST ("touch.exe") +TOUCH = touch.exe $@ +!ELSE +TOUCH = @if exist $@ ( copy /b $@+,, ) else ( type nul >$@ ) +!ENDIF + +# In case some package like GnuWin32, UnixUtils, gettext +# or something similar is installed on the system. +# If the "iconv" program is installed on the system, but it is not registered +# in the %PATH% environment variable, then specify the full path to this file. +!IF EXIST ("iconv.exe") +ICONV = iconv.exe +!ELSEIF EXIST ("$(GETTEXT_PATH)\iconv.exe") +ICONV="$(GETTEXT_PATH)\iconv.exe" +!ENDIF + +RM = del /q + +.SUFFIXES : +.SUFFIXES : .c .o .txt .html + + +all : tags perlhtml $(CONVERTED) + +# Use "doctags" to generate the tags file. Only works for English! +tags : doctags $(DOCS) + doctags $(DOCS) | sort /L C /O tags + powershell -nologo -noprofile -Command\ + "(Get-Content -Raw tags | Get-Unique | % {$$_ -replace \"`r\", \"\"}) |\ + New-Item -Force -Path . -ItemType file -Name tags" + +doctags : doctags.c + $(CC) doctags.c + + +# Use Vim to generate the tags file. Can only be used when Vim has been +# compiled and installed. Supports multiple languages. +vimtags : $(DOCS) + $(VIMEXE) --clean -esX -V1 -u doctags.vim + + + +uganda.nsis.txt : uganda.* + !powershell -nologo -noprofile -Command\ + $$ext=(Get-Item $?).Extension; (Get-Content $? ^| \ + % {$$_ -replace '\s*\*[-a-zA-Z0-9.]*\*', '' -replace 'vim:tw=78:.*', ''})\ + ^| Set-Content $*$$ext + !powershell -nologo -noprofile -Command\ + $$ext=(Get-Item $?).Extension;\ + (Get-Content -Raw $(@B)$$ext).Trim() -replace '(\r\n){3,}', '$$1$$1'\ + ^| Set-Content $(@B)$$ext + + +# TODO: +#html: noerrors tags $(HTMLS) +# if exist errors.log (more errors.log) + +# TODO: +#noerrors: +# $(RM) errors.log + +# TODO: +#.txt.html: + + +# TODO: +#index.html: help.txt + + +# TODO: +#vimindex.html: index.txt + + +# TODO: +#tags.ref tags.html: tags + +# Perl version of .txt to .html conversion. +# There can't be two rules to produce a .html from a .txt file. +# Just run over all .txt files each time one changes. It's fast anyway. +perlhtml : tags $(DOCS) + vim2html.pl tags $(DOCS) + +# Check URLs in the help with "curl" or "powershell". +test_urls : + $(VIMEXE) -S test_urls.vim + +clean : + $(RM) doctags.exe doctags.obj + $(RM) *.html vim-stylesheet.css + + + +arabic.txt : + $(TOUCH) + +farsi.txt : + $(TOUCH) + +hebrew.txt : + $(TOUCH) + +russian.txt : + $(TOUCH) + +gui_w32.txt : + $(TOUCH) + +if_ole.txt : + $(TOUCH) + +os_390.txt : + $(TOUCH) + +os_amiga.txt : + $(TOUCH) + +os_beos.txt : + $(TOUCH) + +os_dos.txt : + $(TOUCH) + +os_haiku.txt : + $(TOUCH) + +os_mac.txt : + $(TOUCH) + +os_mint.txt : + $(TOUCH) + +os_msdos.txt : + $(TOUCH) + +os_os2.txt : + $(TOUCH) + +os_qnx.txt : + $(TOUCH) + +os_risc.txt : + $(TOUCH) + +os_win32.txt : + $(TOUCH) + + +convert-all : $(CONVERTED) +!IF [powershell -nologo -noprofile "exit $$psversiontable.psversion.major"] == 2 +!ERROR The program "PowerShell" version 3.0 or higher is required to work +!ENDIF + +vim-da.UTF-8.1 : vim-da.1 +!IF DEFINED (ICONV) + $(ICONV) -f ISO-8859-1 -t UTF-8 $? >$@ +!ELSE +# Conversion to UTF-8 encoding without BOM and with UNIX-like line ending + powershell -nologo -noprofile -Command\ + [IO.File]::ReadAllText(\"$?\", [Text.Encoding]::GetEncoding(28591)) ^|\ + 1>nul New-Item -Force -Path . -ItemType file -Name $@ +!ENDIF + +vimdiff-da.UTF-8.1 : vimdiff-da.1 +!IF DEFINED (ICONV) + $(ICONV) -f ISO-8859-1 -t UTF-8 $? >$@ +!ELSE +# Conversion to UTF-8 encoding without BOM and with UNIX-like line ending + powershell -nologo -noprofile -Command\ + [IO.File]::ReadAllText(\"$?\", [Text.Encoding]::GetEncoding(28591)) ^|\ + 1>nul New-Item -Force -Path . -ItemType file -Name $@ +!ENDIF + +vimtutor-da.UTF-8.1 : vimtutor-da.1 +!IF DEFINED (ICONV) + $(ICONV) -f ISO-8859-1 -t UTF-8 $? >$@ +!ELSE +# Conversion to UTF-8 encoding without BOM and with UNIX-like line ending + powershell -nologo -noprofile -Command\ + [IO.File]::ReadAllText(\"$?\", [Text.Encoding]::GetEncoding(28591)) ^|\ + 1>nul New-Item -Force -Path . -ItemType file -Name $@ +!ENDIF + +vim-de.UTF-8.1 : vim-de.1 +!IF DEFINED (ICONV) + $(ICONV) -f ISO-8859-1 -t UTF-8 $? >$@ +!ELSE +# Conversion to UTF-8 encoding without BOM and with UNIX-like line ending + powershell -nologo -noprofile -Command\ + [IO.File]::ReadAllText(\"$?\", [Text.Encoding]::GetEncoding(28591)) ^|\ + 1>nul New-Item -Force -Path . -ItemType file -Name $@ +!ENDIF + +evim-fr.UTF-8.1 : evim-fr.1 +!IF DEFINED (ICONV) + $(ICONV) -f ISO-8859-1 -t UTF-8 $? >$@ +!ELSE +# Conversion to UTF-8 encoding without BOM and with UNIX-like line ending + powershell -nologo -noprofile -Command\ + [IO.File]::ReadAllText(\"$?\", [Text.Encoding]::GetEncoding(28591)) ^|\ + 1>nul New-Item -Force -Path . -ItemType file -Name $@ +!ENDIF + +vim-fr.UTF-8.1 : vim-fr.1 +!IF DEFINED (ICONV) + $(ICONV) -f ISO-8859-1 -t UTF-8 $? >$@ +!ELSE +# Conversion to UTF-8 encoding without BOM and with UNIX-like line ending + powershell -nologo -noprofile -Command\ + [IO.File]::ReadAllText(\"$?\", [Text.Encoding]::GetEncoding(28591)) ^|\ + 1>nul New-Item -Force -Path . -ItemType file -Name $@ +!ENDIF + +vimdiff-fr.UTF-8.1 : vimdiff-fr.1 +!IF DEFINED (ICONV) + $(ICONV) -f ISO-8859-1 -t UTF-8 $? >$@ +!ELSE +# Conversion to UTF-8 encoding without BOM and with UNIX-like line ending + powershell -nologo -noprofile -Command\ + [IO.File]::ReadAllText(\"$?\", [Text.Encoding]::GetEncoding(28591)) ^|\ + 1>nul New-Item -Force -Path . -ItemType file -Name $@ +!ENDIF + +vimtutor-fr.UTF-8.1 : vimtutor-fr.1 +!IF DEFINED (ICONV) + $(ICONV) -f ISO-8859-1 -t utf-8 $? >$@ +!ELSE +# Conversion to UTF-8 encoding without BOM and with UNIX-like line ending + powershell -nologo -noprofile -Command\ + [IO.File]::ReadAllText(\"$?\", [Text.Encoding]::GetEncoding(28591)) ^|\ + 1>nul New-Item -Force -Path . -ItemType file -Name $@ +!ENDIF + +xxd-fr.UTF-8.1 : xxd-fr.1 +!IF DEFINED (ICONV) + $(ICONV) -f ISO-8859-1 -t UTF-8 $? >$@ +!ELSE +# Conversion to UTF-8 encoding without BOM and with UNIX-like line ending + powershell -nologo -noprofile -Command\ + [IO.File]::ReadAllText(\"$?\", [Text.Encoding]::GetEncoding(28591)) ^|\ + 1>nul New-Item -Force -Path . -ItemType file -Name $@ +!ENDIF + +evim-it.UTF-8.1 : evim-it.1 +!IF DEFINED (ICONV) + $(ICONV) -f ISO-8859-1 -t UTF-8 $? >$@ +!ELSE +# Conversion to UTF-8 encoding without BOM and with UNIX-like line ending + powershell -nologo -noprofile -Command\ + [IO.File]::ReadAllText(\"$?\", [Text.Encoding]::GetEncoding(28591)) ^|\ + 1>nul New-Item -Force -Path . -ItemType file -Name $@ +!ENDIF + +vim-it.UTF-8.1 : vim-it.1 +!IF DEFINED (ICONV) + $(ICONV) -f ISO-8859-1 -t UTF-8 $? >$@ +!ELSE +# Conversion to UTF-8 encoding without BOM and with UNIX-like line ending + powershell -nologo -noprofile -Command\ + [IO.File]::ReadAllText(\"$?\", [Text.Encoding]::GetEncoding(28591)) ^|\ + 1>nul New-Item -Force -Path . -ItemType file -Name $@ +!ENDIF + +vimdiff-it.UTF-8.1 : vimdiff-it.1 +!IF DEFINED (ICONV) + $(ICONV) -f ISO-8859-1 -t UTF-8 $? >$@ +!ELSE +# Conversion to UTF-8 encoding without BOM and with UNIX-like line ending + powershell -nologo -noprofile -Command\ + [IO.File]::ReadAllText(\"$?\", [Text.Encoding]::GetEncoding(28591)) ^|\ + 1>nul New-Item -Force -Path . -ItemType file -Name $@ +!ENDIF + +vimtutor-it.UTF-8.1 : vimtutor-it.1 +!IF DEFINED (ICONV) + $(ICONV) -f ISO-8859-1 -t UTF-8 $? >$@ +!ELSE +# Conversion to UTF-8 encoding without BOM and with UNIX-like line ending + powershell -nologo -noprofile -Command\ + [IO.File]::ReadAllText(\"$?\", [Text.Encoding]::GetEncoding(28591)) ^|\ + 1>nul New-Item -Force -Path . -ItemType file -Name $@ +!ENDIF + +xxd-it.UTF-8.1 : xxd-it.1 +!IF DEFINED (ICONV) + $(ICONV) -f ISO-8859-1 -t UTF-8 $? >$@ +!ELSE +# Conversion to UTF-8 encoding without BOM and with UNIX-like line ending + powershell -nologo -noprofile -Command\ + [IO.File]::ReadAllText(\"$?\", [Text.Encoding]::GetEncoding(28591)) ^|\ + 1>nul New-Item -Force -Path . -ItemType file -Name $@ +!ENDIF + +evim-pl.UTF-8.1 : evim-pl.1 +!IF DEFINED (ICONV) + $(ICONV) -f ISO-8859-2 -t UTF-8 $? >$@ +!ELSE +# Conversion to UTF-8 encoding without BOM and with UNIX-like line ending + powershell -nologo -noprofile -Command\ + [IO.File]::ReadAllText(\"$?\", [Text.Encoding]::GetEncoding(28592)) ^|\ + 1>nul New-Item -Force -Path . -ItemType file -Name $@ +!ENDIF + +vim-pl.UTF-8.1 : vim-pl.1 +!IF DEFINED (ICONV) + $(ICONV) -f ISO-8859-2 -t UTF-8 $? >$@ +!ELSE +# Conversion to UTF-8 encoding without BOM and with UNIX-like line ending + powershell -nologo -noprofile -Command\ + [IO.File]::ReadAllText(\"$?\", [Text.Encoding]::GetEncoding(28592)) ^|\ + 1>nul New-Item -Force -Path . -ItemType file -Name $@ +!ENDIF + +vimdiff-pl.UTF-8.1 : vimdiff-pl.1 +!IF DEFINED (ICONV) + $(ICONV) -f ISO-8859-2 -t UTF-8 $? >$@ +!ELSE +# Conversion to UTF-8 encoding without BOM and with UNIX-like line ending + powershell -nologo -noprofile -Command\ + [IO.File]::ReadAllText(\"$?\", [Text.Encoding]::GetEncoding(28592)) ^|\ + 1>nul New-Item -Force -Path . -ItemType file -Name $@ +!ENDIF + +vimtutor-pl.UTF-8.1 : vimtutor-pl.1 +!IF DEFINED (ICONV) + $(ICONV) -f ISO-8859-2 -t UTF-8 $? >$@ +!ELSE +# Conversion to UTF-8 encoding without BOM and with UNIX-like line ending + powershell -nologo -noprofile -Command\ + [IO.File]::ReadAllText(\"$?\", [Text.Encoding]::GetEncoding(28592)) ^|\ + 1>nul New-Item -Force -Path . -ItemType file -Name $@ +!ENDIF + +xxd-pl.UTF-8.1 : xxd-pl.1 +!IF DEFINED (ICONV) + $(ICONV) -f ISO-8859-2 -t UTF-8 $? >$@ +!ELSE +# Conversion to UTF-8 encoding without BOM and with UNIX-like line ending + powershell -nologo -noprofile -Command\ + [IO.File]::ReadAllText(\"$?\", [Text.Encoding]::GetEncoding(28592)) ^|\ + 1>nul New-Item -Force -Path . -ItemType file -Name $@ +!ENDIF + +evim-ru.UTF-8.1 : evim-ru.1 +!IF DEFINED (ICONV) + $(ICONV) -f KOI8-R -t UTF-8 $? >$@ +!ELSE +# Conversion to UTF-8 encoding without BOM and with UNIX-like line ending + powershell -nologo -noprofile -Command\ + [IO.File]::ReadAllText(\"$?\", [Text.Encoding]::GetEncoding(20866)) ^|\ + 1>nul New-Item -Force -Path . -ItemType file -Name $@ +!ENDIF + +vim-ru.UTF-8.1 : vim-ru.1 +!IF DEFINED (ICONV) + $(ICONV) -f KOI8-R -t UTF-8 $? >$@ +!ELSE +# Conversion to UTF-8 encoding without BOM and with UNIX-like line ending + powershell -nologo -noprofile -Command\ + [IO.File]::ReadAllText(\"$?\", [Text.Encoding]::GetEncoding(20866)) ^|\ + 1>nul New-Item -Force -Path . -ItemType file -Name $@ +!ENDIF + +vimdiff-ru.UTF-8.1 : vimdiff-ru.1 +!IF DEFINED (ICONV) + $(ICONV) -f KOI8-R -t UTF-8 $? >$@ +!ELSE +# Conversion to UTF-8 encoding without BOM and with UNIX-like line ending + powershell -nologo -noprofile -Command\ + [IO.File]::ReadAllText(\"$?\", [Text.Encoding]::GetEncoding(20866)) ^|\ + 1>nul New-Item -Force -Path . -ItemType file -Name $@ +!ENDIF + +vimtutor-ru.UTF-8.1 : vimtutor-ru.1 +!IF DEFINED (ICONV) + $(ICONV) -f KOI8-R -t UTF-8 $? >$@ +!ELSE +# Conversion to UTF-8 encoding without BOM and with UNIX-like line ending + powershell -nologo -noprofile -Command\ + [IO.File]::ReadAllText(\"$?\", [Text.Encoding]::GetEncoding(20866)) ^|\ + 1>nul New-Item -Force -Path . -ItemType file -Name $@ +!ENDIF + +xxd-ru.UTF-8.1 : xxd-ru.1 +!IF DEFINED (ICONV) + $(ICONV) -f KOI8-R -t UTF-8 $? >$@ +!ELSE +# Conversion to UTF-8 encoding without BOM and with UNIX-like line ending + powershell -nologo -noprofile -Command\ + [IO.File]::ReadAllText(\"$?\", [Text.Encoding]::GetEncoding(20866)) ^|\ + 1>nul New-Item -Force -Path . -ItemType file -Name $@ +!ENDIF + +evim-tr.UTF-8.1 : evim-tr.1 +!IF DEFINED (ICONV) + $(ICONV) -f ISO-8859-9 -t UTF-8 $? >$@ +!ELSE +! IF [powershell -nologo -noprofile "exit $$psversiontable.psversion.major"] == 2 +! ERROR Для работы требуется программа «PowerShell» версии 3.0 или выше +! ENDIF +# Conversion to UTF-8 encoding without BOM and with UNIX-like line ending + powershell -nologo -noprofile -Command\ + [IO.File]::ReadAllText(\"$?\", [Text.Encoding]::GetEncoding(28599)) ^|\ + 1>nul New-Item -Force -Path . -ItemType file -Name $@ +!ENDIF + +vim-tr.UTF-8.1 : vim-tr.1 +!IF DEFINED (ICONV) + $(ICONV) -f ISO-8859-9 -t UTF-8 $? >$@ +!ELSE +# Conversion to UTF-8 encoding without BOM and with UNIX-like line ending + powershell -nologo -noprofile -Command\ + [IO.File]::ReadAllText(\"$?\", [Text.Encoding]::GetEncoding(28599)) ^|\ + 1>nul New-Item -Force -Path . -ItemType file -Name $@ +!ENDIF + +vimdiff-tr.UTF-8.1 : vimdiff-tr.1 +!IF DEFINED (ICONV) + $(ICONV) -f ISO-8859-9 -t UTF-8 $? >$@ +!ELSE +# Conversion to UTF-8 encoding without BOM and with UNIX-like line ending + powershell -nologo -noprofile -Command\ + [IO.File]::ReadAllText(\"$?\", [Text.Encoding]::GetEncoding(28599)) ^|\ + 1>nul New-Item -Force -Path . -ItemType file -Name $@ +!ENDIF + +vimtutor-tr.UTF-8.1 : vimtutor-tr.1 +!IF DEFINED (ICONV) + $(ICONV) -f ISO-8859-9 -t UTF-8 $? >$@ +!ELSE +# Conversion to UTF-8 encoding without BOM and with UNIX-like line ending + powershell -nologo -noprofile -Command\ + [IO.File]::ReadAllText(\"$?\", [Text.Encoding]::GetEncoding(28599)) ^|\ + 1>nul New-Item -Force -Path . -ItemType file -Name $@ +!ENDIF + + + +# vim: set noet sw=8 ts=8 sts=0 wm=0 tw=0 ft=make: diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index 5faabef6ce..e04981a833 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -1,4 +1,4 @@ -*options.txt* For Vim version 9.0. Last change: 2023 Oct 14 +*options.txt* For Vim version 9.0. Last change: 2023 Oct 23 VIM REFERENCE MANUAL by Bram Moolenaar @@ -71,7 +71,7 @@ achieve special effects. These options come in three forms: 'ttytype' Warning: This may have a lot of side effects. - *:set-args* *:set=* *E487* *E521* + *:set-args* *:set=* *E487* *E521* :se[t] {option}={value} or :se[t] {option}:{value} Set string or number option to {value}. @@ -1609,6 +1609,8 @@ A jump table for the options with a short description can be found at |Q_op|. current working directory to the |$HOME| directory like in Unix. When off, those commands just print the current directory name. On Unix this option has no effect. + This option cannot be set from a |modeline| or in the |sandbox|, for + security reasons. NOTE: This option is reset when 'compatible' is set. *'cdpath'* *'cd'* *E344* *E346* @@ -1986,6 +1988,8 @@ A jump table for the options with a short description can be found at |Q_op|. 'delcombine' + off unicode: delete whole char combination 'digraph' + off no digraphs 'esckeys' & off no -keys in Insert mode + this also disables |modifyOtherKeys| + and |xterm-bracketed-paste| 'expandtab' + off tabs not expanded to spaces 'fileformats' & "" no automatic file format detection, "dos,unix" except for MS-Windows @@ -3230,9 +3234,9 @@ A jump table for the options with a short description can be found at |Q_op|. won't work by default. NOTE: This option is set to the Vi default value when 'compatible' is set and to the Vim default value when 'compatible' is reset. - NOTE: when this option is off then the |modifyOtherKeys| functionality - is disabled while in Insert mode to avoid ending Insert mode with any - key that has a modifier. + NOTE: when this option is off then the |modifyOtherKeys| and + |xterm-bracketed-paste| functionality is disabled while in Insert mode + to avoid ending Insert mode with any key that has a modifier. *'eventignore'* *'ei'* 'eventignore' 'ei' string (default "") @@ -4415,8 +4419,8 @@ A jump table for the options with a short description can be found at |Q_op|. |hl-PmenuSel| = popup menu selected line |hl-PmenuKind| [ popup menu "kind" normal line |hl-PmenuKindSel| ] popup menu "kind" selected line - |hl-PmenuExtra| { popup menu "kind" normal line - |hl-PmenuExtraSel| } popup menu "kind" selected line + |hl-PmenuExtra| { popup menu "extra" normal line + |hl-PmenuExtraSel| } popup menu "extra" selected line |hl-PmenuSbar| x popup menu scrollbar |hl-PmenuThumb| X popup menu scrollbar thumb @@ -5719,7 +5723,8 @@ A jump table for the options with a short description can be found at |Q_op|. < If you have less than 512 Mbyte |:mkspell| may fail for some languages, no matter what you set 'mkspellmem' to. - This option cannot be set from a |modeline| or in the |sandbox|. + This option cannot be set from a |modeline| or in the |sandbox|, for + security reasons. *'modeline'* *'ml'* *'nomodeline'* *'noml'* 'modeline' 'ml' boolean (Vim default: on (off for root), @@ -5878,7 +5883,7 @@ A jump table for the options with a short description can be found at |Q_op|. The 'mousemodel' option is set by the |:behave| command. - *'mousemoveevent'* *'mousemev'* *'nomousemoveevent'* *'nomousemev'* + *'mousemoveevent'* *'mousemev'* *'nomousemoveevent'* *'nomousemev'* 'mousemoveevent' 'mousemev' boolean (default off) global {only works in the GUI} @@ -6121,6 +6126,8 @@ A jump table for the options with a short description can be found at |Q_op|. *'packpath'* *'pp'* 'packpath' 'pp' string (default: see 'runtimepath') Directories used to find packages. See |packages|. + This option cannot be set from a |modeline| or in the |sandbox|, for + security reasons. *'paragraphs'* *'para'* @@ -6205,6 +6212,8 @@ A jump table for the options with a short description can be found at |Q_op|. feature} Expression which is evaluated to apply a patch to a file and generate the resulting new version of the file. See |diff-patchexpr|. + This option cannot be set from a |modeline| or in the |sandbox|, for + security reasons. *'patchmode'* *'pm'* *E205* *E206* 'patchmode' 'pm' string (default "") @@ -7287,6 +7296,8 @@ A jump table for the options with a short description can be found at |Q_op|. When 'shellxquote' is set to "(" then the characters listed in this option will be escaped with a '^' character. This makes it possible to execute most external commands with cmd.exe. + This option cannot be set from a |modeline| or in the |sandbox|, for + security reasons. *'shellxquote'* *'sxq'* 'shellxquote' 'sxq' string (default: ""; @@ -8127,7 +8138,7 @@ A jump table for the options with a short description can be found at |Q_op|. This option controls the behavior when switching between buffers. This option is checked, when - jumping to errors with the |quickfix| commands (|:cc|, |:cn|, |:cp|, - etc.) + etc.). - jumping to a tag using the |:stag| command. - opening a file using the |CTRL-W_f| or |CTRL-W_F| command. - jumping to a buffer using a buffer split command (e.g. |:sbuffer|, @@ -8343,6 +8354,8 @@ A jump table for the options with a short description can be found at |Q_op|. function and an example. The value can be the name of a function, a |lambda| or a |Funcref|. See |option-value-function| for more information. + This option cannot be set from a |modeline| or in the |sandbox|, for + security reasons. *'taglength'* *'tl'* 'taglength' 'tl' number (default 0) @@ -9115,12 +9128,14 @@ A jump table for the options with a short description can be found at |Q_op|. Setting 'verbosefile' to a new value is like making it empty first. The difference with |:redir| is that verbose messages are not displayed when 'verbosefile' is set. + This option cannot be set from a |modeline| or in the |sandbox|, for + security reasons. *'viewdir'* *'vdir'* -'viewdir' 'vdir' string (default for Amiga "home:vimfiles/view", +'viewdir' 'vdir' string (default for Amiga: "home:vimfiles/view", for Win32: "$HOME/vimfiles/view", for Unix: "$HOME/.vim/view", - for macOS: "$VIM/vimfiles/view" + for macOS: "$VIM/vimfiles/view", for VMS: "sys$login:vimfiles/view") global {not available when compiled without the |+mksession| diff --git a/runtime/doc/pattern.txt b/runtime/doc/pattern.txt index 4fa26e0431..70227a72e2 100644 --- a/runtime/doc/pattern.txt +++ b/runtime/doc/pattern.txt @@ -1,4 +1,4 @@ -*pattern.txt* For Vim version 9.0. Last change: 2023 Feb 04 +*pattern.txt* For Vim version 9.0. Last change: 2023 Oct 23 VIM REFERENCE MANUAL by Bram Moolenaar @@ -1461,10 +1461,11 @@ Finally, these constructs are unique to Perl: Just like |:match| above, but set a separate match. Thus there can be three matches active at the same time. The match with the lowest number has priority if several match at the - same position. - The ":3match" command is used by the |matchparen| plugin. You - are suggested to use ":match" for manual matching and - ":2match" for another plugin. + same position. It uses the match id 3. + The ":3match" command is used by (Vim < 9.0.2054) |matchparen| + plugin. You are suggested to use ":match" for manual matching + and ":2match" for another plugin or even better make use of + the more flexible |matchadd()| (and similar) functions instead. ============================================================================== 11. Fuzzy matching *fuzzy-matching* diff --git a/runtime/doc/pi_gzip.txt b/runtime/doc/pi_gzip.txt index e5d5ffb25f..c5d8ab0d84 100644 --- a/runtime/doc/pi_gzip.txt +++ b/runtime/doc/pi_gzip.txt @@ -1,4 +1,4 @@ -*pi_gzip.txt* For Vim version 9.0. Last change: 2019 May 05 +*pi_gzip.txt* For Vim version 9.0. Last change: 2023 Nov 05 VIM REFERENCE MANUAL by Bram Moolenaar @@ -12,9 +12,17 @@ The functionality mentioned here is a |standard-plugin|. This plugin is only available if 'compatible' is not set. You can avoid loading this plugin by setting the "loaded_gzip" variable: > :let loaded_gzip = 1 +< + *g:gzip_exec* + +For security reasons, one may prevent that Vim runs executables automatically +when opening a buffer. This option (default: "1") can be used to prevent +executing the executables command when set to "0": > + :let g:gzip_exec = 0 +< ============================================================================== -1. Autocommands *gzip-autocmd* +2. Autocommands *gzip-autocmd* The plugin installs autocommands to intercept reading and writing of files with these extensions: diff --git a/runtime/doc/pi_zip.txt b/runtime/doc/pi_zip.txt index 8673324e11..14ae340155 100644 --- a/runtime/doc/pi_zip.txt +++ b/runtime/doc/pi_zip.txt @@ -1,4 +1,4 @@ -*pi_zip.txt* For Vim version 9.0. Last change: 2023 Mar 12 +*pi_zip.txt* For Vim version 9.0. Last change: 2023 Nov 05 +====================+ | Zip File Interface | @@ -69,6 +69,13 @@ Copyright: Copyright (C) 2005-2015 Charles E Campbell *zip-copyright* This option specifies the program (and any options needed) used to extract a file from a zip archive. By default, > let g:zip_extractcmd= g:zip_unzipcmd +< + *g:zip_exec* + For security reasons, one may prevent that Vim runs executables + automatically when opening a buffer. This option (default: "1") + can be used to prevent executing the "unzip" command when set to + "0": > + let g:zip_exec=0 < PREVENTING LOADING~ diff --git a/runtime/doc/quickfix.txt b/runtime/doc/quickfix.txt index 96ba382488..cbfd791d5d 100644 --- a/runtime/doc/quickfix.txt +++ b/runtime/doc/quickfix.txt @@ -1422,6 +1422,7 @@ rest is ignored. Items can only be 1023 bytes long. Basic items %f file name (finds a string) + %b buffer number (finds a number) %o module name (finds a string) %l line number (finds a number) %e end line number (finds a number) @@ -1461,6 +1462,11 @@ On MS-Windows a leading "C:" will be included in "%f", even when using "%f:". This means that a file name which is a single alphabetical letter will not be detected. +The "%b" conversion is used to parse a buffer number. This is useful for +referring to lines in a scratch buffer or a buffer with no name. If a buffer +with the matching number doesn't exist, then that line is used as a non-error +line. + The "%p" conversion is normally followed by a "^". It's used for compilers that output a line like: > ^ diff --git a/runtime/doc/starting.txt b/runtime/doc/starting.txt index fa58f0dc56..56acd6c294 100644 --- a/runtime/doc/starting.txt +++ b/runtime/doc/starting.txt @@ -1,4 +1,4 @@ -*starting.txt* For Vim version 9.0. Last change: 2023 Oct 17 +*starting.txt* For Vim version 9.0. Last change: 2023 Oct 20 VIM REFERENCE MANUAL by Bram Moolenaar @@ -249,10 +249,10 @@ a slash. Thus "-R" means recovery and "-/R" readonly. *-Z* *restricted-mode* *E145* *E981* -Z Restricted mode. All commands that make use of an external shell are disabled. This includes suspending with CTRL-Z, - ":sh", filtering, the system() function, backtick expansion + ":sh", filtering, the |system()| function, backtick expansion and libcall(). - Also disallowed are delete(), rename(), mkdir(), job_start(), - etc. + Also disallowed are |delete()|, |rename()|, |mkdir()|, + |job_start()|, |setenv()| etc. Interfaces, such as Python, Ruby and Lua, are also disabled, since they could be used to execute shell commands. Perl uses the Safe module. diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt index 001c395a36..5da3ec8977 100644 --- a/runtime/doc/syntax.txt +++ b/runtime/doc/syntax.txt @@ -2797,7 +2797,7 @@ The first option implies the second one. For highlighted trailing whitespace and mix of spaces and tabs: > :let python_space_error_highlight = 1 -If you want all possible Python highlighting: +If you want all possible Python highlighting: > :let python_highlight_all = 1 This has the same effect as setting python_space_error_highlight and unsetting all the other ones. diff --git a/runtime/doc/tags b/runtime/doc/tags index db66f21567..8fe24c9434 100644 --- a/runtime/doc/tags +++ b/runtime/doc/tags @@ -6857,6 +6857,8 @@ dircolors.vim syntax.txt /*dircolors.vim* dis motion.txt /*dis* disable-menus gui.txt /*disable-menus* discard editing.txt /*discard* +dist#vim eval.txt /*dist#vim* +dist#vim9 eval.txt /*dist#vim9* distribute-script usr_51.txt /*distribute-script* distributed-plugins usr_05.txt /*distributed-plugins* distribution intro.txt /*distribution* @@ -7522,6 +7524,7 @@ g:gnat.Project_File ft_ada.txt /*g:gnat.Project_File* g:gnat.Set_Project_File() ft_ada.txt /*g:gnat.Set_Project_File()* g:gnat.Tags() ft_ada.txt /*g:gnat.Tags()* g:gnat.Tags_Command ft_ada.txt /*g:gnat.Tags_Command* +g:gzip_exec pi_gzip.txt /*g:gzip_exec* g:html_charset_override syntax.txt /*g:html_charset_override* g:html_diff_one_file syntax.txt /*g:html_diff_one_file* g:html_dynamic_folds syntax.txt /*g:html_dynamic_folds* @@ -7718,6 +7721,7 @@ g:vimsyn_minlines syntax.txt /*g:vimsyn_minlines* g:vimsyn_noerror syntax.txt /*g:vimsyn_noerror* g:yaml_schema syntax.txt /*g:yaml_schema* g:zipPlugin_ext pi_zip.txt /*g:zipPlugin_ext* +g:zip_exec pi_zip.txt /*g:zip_exec* g:zip_extractcmd pi_zip.txt /*g:zip_extractcmd* g:zip_nomax pi_zip.txt /*g:zip_nomax* g:zip_shq pi_zip.txt /*g:zip_shq* @@ -11154,6 +11158,7 @@ vim-modes intro.txt /*vim-modes* vim-modes-intro intro.txt /*vim-modes-intro* vim-raku ft_raku.txt /*vim-raku* vim-script-intro usr_41.txt /*vim-script-intro* +vim-script-library eval.txt /*vim-script-library* vim-use intro.txt /*vim-use* vim-variable eval.txt /*vim-variable* vim.b if_lua.txt /*vim.b* @@ -11177,6 +11182,7 @@ vim9-differences vim9.txt /*vim9-differences* vim9-export vim9.txt /*vim9-export* vim9-false-true vim9.txt /*vim9-false-true* vim9-final vim9.txt /*vim9-final* +vim9-func-declaration vim9.txt /*vim9-func-declaration* vim9-function-defined-later vim9.txt /*vim9-function-defined-later* vim9-gotchas vim9.txt /*vim9-gotchas* vim9-ignored-argument vim9.txt /*vim9-ignored-argument* diff --git a/runtime/doc/term.txt b/runtime/doc/term.txt index cb4c676834..9526f2b802 100644 --- a/runtime/doc/term.txt +++ b/runtime/doc/term.txt @@ -1,4 +1,4 @@ -*term.txt* For Vim version 9.0. Last change: 2023 Jan 15 +*term.txt* For Vim version 9.0. Last change: 2023 Nov 04 VIM REFERENCE MANUAL by Bram Moolenaar @@ -104,6 +104,11 @@ pasted text. This way Vim can separate text that is pasted from characters that are typed. The pasted text is handled like when the middle mouse button is used, it is inserted literally and not interpreted as commands. +Please note: while bracketed paste is trying to prevent nasty side-effects +from pasting (like the CTRL-C or key), it's not a guaranteed security +measure because different terminals may implement this mode slightly +differently. You should still be careful with what you paste into Vim. + When the cursor is in the first column, the pasted text will be inserted before it. Otherwise the pasted text is appended after the cursor position. This means one cannot paste after the first column. Unfortunately Vim does @@ -122,6 +127,9 @@ If |t_PS| or |t_PE| is not set, then |t_BE| will not be used. This is to make sure that bracketed paste is not enabled when the escape codes surrounding pasted text cannot be recognized. +Note: bracketed paste mode will be disabled, when the 'esckeys' option is not +set (also when the 'compatible' option is set). + If your terminal supports bracketed paste, but the options are not set automatically, you can try using something like this: > @@ -324,11 +332,16 @@ using the "xterm" workaround. These are the relevant entries (so far): XM "\033[?1006;1004;1000%?%p1%{1}%=%th%el%;" mouse enable / disable |t_XM| + FE "\033[?1004h" enable focus event tracking |t_fe| + FD "\033[?1004l" disable focus event tracking |t_fd| The "XM" entry includes "1006" to enable SGR style mouse reporting. This supports columns above 223. It also includes "1004" which enables focus -reporting. The t_fe and t_fd entries can be left empty (they don't have -entries in terminfo/termcap anyway). +reporting. +Note: As of 2023, the "1004" is currently not used by Vim itself, instead +it is recommended to set focus reporting independently of mouse tracking by +the |t_fe| and |t_fd| entries, as ncurses also starts to use with the latest +versions (and will then also end up in terminfo/termcap). *xterm-kitty* *kitty-terminal* The Kitty terminal is a special case. Mainly because it works differently diff --git a/runtime/doc/terminal.txt b/runtime/doc/terminal.txt index 62bc6e657e..70cfd7f9aa 100644 --- a/runtime/doc/terminal.txt +++ b/runtime/doc/terminal.txt @@ -1485,8 +1485,9 @@ If there is no g:termdebug_config you can use: > Any value greater than 1 will set the Asm window height to that value. *termdebug_variables_window* -If you want the Var window shown by default, set the flag to 1. -the "variables_window_height" entry can be used to set the window height: > +If you want the Var window shown by default, set the "variables_window" flag +to 1. The "variables_window_height" entry can be used to set the window +height: > let g:termdebug_config['variables_window'] = 1 let g:termdebug_config['variables_window_height'] = 15 If there is no g:termdebug_config you can use: > diff --git a/runtime/doc/test_urls.vim b/runtime/doc/test_urls.vim index 3580b79475..e23f87966b 100644 --- a/runtime/doc/test_urls.vim +++ b/runtime/doc/test_urls.vim @@ -6,21 +6,41 @@ " Written by Christian Brabandt. func Test_check_URLs() +"20.10.23, added by Restorer if has("win32") - echoerr "Doesn't work on MS-Windows" - return + let s:outdev = 'nul' + else + let s:outdev = '/dev/null' endif +" Restorer: For Windows users. If "curl" or "weget" is installed on the system +" but not in %PATH%, add the full routes for them to this environment variable. if executable('curl') " Note: does not follow redirects! - let s:command = 'curl --silent --fail --output /dev/null --head ' + let s:command1 = 'curl --silent --fail --output ' ..s:outdev.. ' --head ' + let s:command2 = "" elseif executable('wget') " Note: only allow a couple of redirects - let s:command = 'wget --quiet -S --spider --max-redirect=2 --timeout=5 --tries=2 -O /dev/null ' + let s:command1 = 'wget --quiet -S --spider --max-redirect=2 --timeout=5 --tries=2 -O ' ..s:outdev.. ' ' + let s:command2 = "" + elseif has("win32") "20.10.23, added by Restorer + if executable('powershell') + if 2 == system('powershell -nologo -noprofile "$psversiontable.psversion.major"') + echoerr 'To work in OS Windows requires the program "PowerShell" version 3.0 or higher' + return + endif + let s:command1 = + \ "powershell -nologo -noprofile \"{[Net.ServicePointManager]::SecurityProtocol = 'Tls12, Tls11, Tls, Ssl3'};try{(Invoke-WebRequest -MaximumRedirection 2 -TimeoutSec 5 -Uri " + let s:command2 = ').StatusCode}catch{exit [int]$Error[0].Exception.Status}"' + endif else - echoerr 'Only works when "curl" or "wget" is available' + echoerr 'Only works when "curl" or "wget", or "powershell" is available' return endif + " Do the testing. + set report =999 + set nomore shm +=s + let pat='\(https\?\|ftp\)://[^\t* ]\+' exe 'helpgrep' pat helpclose @@ -36,22 +56,21 @@ func Test_check_URLs() put =urls " remove some more invalid items " empty lines - v/./d + "20.10.23, Restorer: '_' is a little faster, see `:h global` + v/./d _ " remove # anchors %s/#.*$//e " remove trailing stuff (parenthesis, dot, comma, quotes), but only for HTTP " links - g/^h/s#[.,)'"/>][:.]\?$## - g#^[hf]t\?tp:/\(/\?\.*\)$#d - silent! g/ftp://,$/d - silent! g/=$/d + g/^h/s#[.),'"`/>][:.,]\?$## + g#^[hf]t\?tp:/\(/\?\.*\)$#d _ + silent! g/ftp://,$/d _ + silent! g/=$/d _ let a = getline(1,'$') let a = uniq(sort(a)) - %d + %d _ call setline(1, a) - " Do the testing. - set nomore %s/.*/\=TestURL(submatch(0))/ " highlight the failures @@ -61,8 +80,10 @@ endfunc func TestURL(url) " Relies on the return code to determine whether a page is valid echom printf("Testing URL: %d/%d %s", line('.'), line('$'), a:url) - call system(s:command . shellescape(a:url)) + call system(s:command1 .. shellescape(a:url) .. s:command2) return printf("%s %d", a:url, v:shell_error) endfunc call Test_check_URLs() + +" vim: sw=2 sts=2 et diff --git a/runtime/doc/todo.txt b/runtime/doc/todo.txt index 4dc8db44b6..3a7b6ef755 100644 --- a/runtime/doc/todo.txt +++ b/runtime/doc/todo.txt @@ -5945,8 +5945,6 @@ Various improvements: 7 Instead of filtering errors with a shell script it should be possible to do this with Vim script. A function that filters the raw text that comes from the 'makeprg'? -- Add %b to 'errorformat': buffer number. (Yegappan Lakshmanan / Suresh - Govindachar) 7 Allow a window not to have a statusline. Makes it possible to use a window as a buffer-tab selection. 8 Allow non-active windows to have a different statusline. (Yakov Lerner) diff --git a/runtime/doc/userfunc.txt b/runtime/doc/userfunc.txt index 138f27ee82..1fe780076c 100644 --- a/runtime/doc/userfunc.txt +++ b/runtime/doc/userfunc.txt @@ -443,7 +443,8 @@ Any return value of the deferred function is discarded. The function cannot be followed by anything, such as "->func" or ".member". Currently `:defer GetArg()->TheFunc()` does not work, it may work in a later version. -Errors are reported but do not cause aborting execution of deferred functions. +Errors are reported but do not cause aborting execution of deferred functions +or altering execution outside of deferred functions. No range is accepted. The function can be a partial with extra arguments, but not with a dictionary. *E1300* diff --git a/runtime/doc/usr_41.txt b/runtime/doc/usr_41.txt index 53568e907a..3961f5de19 100644 --- a/runtime/doc/usr_41.txt +++ b/runtime/doc/usr_41.txt @@ -877,7 +877,8 @@ Other computation: *bitwise-function* srand() initialize seed used by rand() Variables: *var-functions* - instanceof() check if a variable is an instance of a given class + instanceof() check if a variable is an instance of a given + class type() type of a variable as a number typename() type of a variable as text islocked() check if a variable is locked diff --git a/runtime/doc/various.txt b/runtime/doc/various.txt index 7ecffe5bca..4c5866e9dc 100644 --- a/runtime/doc/various.txt +++ b/runtime/doc/various.txt @@ -451,7 +451,8 @@ m *+python/dyn* Python 2 interface |python-dynamic| |/dyn| m *+python3* Python 3 interface |python| m *+python3/dyn* Python 3 interface |python-dynamic| |/dyn| m *+python3/dyn-stable* - Python 3 interface |python-dynamic| |python-stable| |/dyn| + Python 3 interface |python-dynamic| |python-stable| + |/dyn| N *+quickfix* |:make| and |quickfix| commands N *+reltime* |reltime()| function, 'hlsearch'/'incsearch' timeout, 'redrawtime' option diff --git a/runtime/doc/vim2html.pl b/runtime/doc/vim2html.pl index 9066b03b16..eddfb3af4c 100644 --- a/runtime/doc/vim2html.pl +++ b/runtime/doc/vim2html.pl @@ -6,11 +6,21 @@ # Sun Feb 24 14:49:17 CET 2002 use strict; +use warnings; use vars qw/%url $date/; %url = (); -$date = `date`; -chop $date; +# 30.11.23, Restorer: +# This command does not work in OS Windows. +# The "date" command in Windows is different from its counterpart in UNIX-like systems. +# The closest analog is the "date /t" command, but how it would work in UNIX, +# I don't know. I've corrected it as best I can. I don't know Perl. +#$date = `date`; +#chop $date; +my ($year) = 1900 + (localtime())[5]; +my ($month) = 1 + (localtime())[4]; +my ($day) = (localtime())[3]; +#$date = localtime(); # outputs like this Fri Nov 3 00:56:59 2023 sub maplink { @@ -164,7 +174,7 @@ sub vim2html } print OUT< -

Generated by vim2html on $date

+

Generated by vim2html on $day.$month.$year

EOF diff --git a/runtime/doc/vim9.txt b/runtime/doc/vim9.txt index 6cabb870d8..bba68ad4a8 100644 --- a/runtime/doc/vim9.txt +++ b/runtime/doc/vim9.txt @@ -1,4 +1,4 @@ -*vim9.txt* For Vim version 9.0. Last change: 2023 Jun 10 +*vim9.txt* For Vim version 9.0. Last change: 2023 Oct 23 VIM REFERENCE MANUAL by Bram Moolenaar @@ -1468,7 +1468,7 @@ return value) results in error *E1031* *E1186* . There is no array type, use list<{type}> instead. For a list constant an efficient implementation is used that avoids allocating a lot of small pieces of memory. - *E1005* *E1007* + *vim9-func-declaration* *E1005* *E1007* A partial and function can be declared in more or less specific ways: func any kind of function reference, no type checking for arguments or return value @@ -1487,13 +1487,14 @@ func({type}) function with argument type, does not return func({type}): {type} function with argument type and return type func(?{type}) function with type of optional argument, does not return a value -func(...{type}) function with type of variable number of - arguments, does not return a value -func({type}, ?{type}, ...{type}): {type} +func(...list<{type}>) function with type of list for variable number + of arguments, does not return a value +func({type}, ?{type}, ...list<{type}>): {type} function with: - type of mandatory argument - type of optional argument - - type of variable number of arguments + - type of list for variable number of + arguments - return type If the return type is "void" the function does not return a value. @@ -1669,6 +1670,26 @@ Same for |extend()|, use |extendnew()| instead, and for |flatten()|, use |flattennew()| instead. Since |flatten()| is intended to always change the type, it can not be used in Vim9 script. +Assigning to a funcref with specified arguments (see |vim9-func-declaration|) +does strict type checking of the arguments. For variable number of arguments +the type must match: > + var FuncRef: func(string, number, bool): number + FuncRef = (v1: string, v2: number, v3: bool) => 777 # OK + FuncRef = (v1: string, v2: number, v3: number) => 777 # Error! + # variable number of arguments must have same type + var FuncVA: func(...list): number + FuncVA = (...v: list): number => v # Error! + FuncVA = (...v: list): number => v # OK, `any` runtime check + FuncVA = (v1: string, v: string2): number => 333 # Error! + FuncVA = (v: list): number => 3 # Error! + +If the destinataion funcref has no specified arguments, then there is no +argument type checking: > + var FuncUnknownArgs: func: number + FuncUnknownArgs = (v): number => v # OK + FuncUnknownArgs = (v1: string, v2: string): number => 3 # OK + FuncUnknownArgs = (...v1: list): number => 333 # OK +< *E1211* *E1217* *E1218* *E1219* *E1220* *E1221* *E1222* *E1223* *E1224* *E1225* *E1226* *E1227* *E1228* *E1238* *E1250* *E1251* *E1252* *E1256* diff --git a/runtime/doc/vim9class.txt b/runtime/doc/vim9class.txt index 00bdf369eb..505cbe62f6 100644 --- a/runtime/doc/vim9class.txt +++ b/runtime/doc/vim9class.txt @@ -28,7 +28,8 @@ Vim9 classes, objects, interfaces, types and enums. The fancy term is "object-oriented programming". You can find lots of study material on this subject. Here we document what |Vim9| script provides, assuming you know the basics already. Added are helpful hints about how to -use this functionality effectively. +use this functionality effectively. Vim9 classes and objects cannot be used +in legacy Vim scripts and legacy functions. The basic item is an object: - An object stores state. It contains one or more variables that can each @@ -410,6 +411,8 @@ prefix when defining the method: > abstract static def SetColor() endclass < +A static method in an abstract class cannot be an abstract method. + *E1373* A class extending the abstract class must implement all the abstract methods. The signature (arguments, argument types and return type) must be exactly the @@ -742,12 +745,15 @@ constructor methods. 7. Type definition *Vim9-type* *:type* -{not implemented yet} - -A type definition is giving a name to a type specification. For Example: > +A type definition is giving a name to a type specification. This also known +type alias. For Example: > - :type ListOfStrings list + :type ListOfStrings = list +The type alias can be used wherever a built-in type can be used. The type +alias name must start with an upper case character. A type alias can be +created only at the script level and not inside a function. A type alias can +be exported and used across scripts. ============================================================================== diff --git a/runtime/filetype.vim b/runtime/filetype.vim index c25b89f553..0de6171d62 100644 --- a/runtime/filetype.vim +++ b/runtime/filetype.vim @@ -818,6 +818,9 @@ au BufNewFile,BufRead *.gleam setf gleam " GLSL au BufNewFile,BufRead *.glsl setf glsl +" GN (generate ninja) files +au BufNewFile,BufRead *.gn,*.gni setf gn + " GP scripts (2.0 and onward) au BufNewFile,BufRead *.gp,.gprc setf gp @@ -1031,6 +1034,9 @@ au BufNewFile,BufRead *.jal,*.JAL setf jal " Jam au BufNewFile,BufRead *.jpl,*.jpr setf jam +" Janet +au BufNewFile,BufRead *.janet setf janet + " Java au BufNewFile,BufRead *.java,*.jav setf java @@ -1456,6 +1462,9 @@ au BufNewFile,BufRead {env,config}.nu setf nu " Oblivion Language and Oblivion Script Extender au BufNewFile,BufRead *.obl,*.obse,*.oblivion,*.obscript setf obse +" Objdump +au BufNewFile,BufRead *.objdump,*.cppobjdump setf objdump + " OCaml au BufNewFile,BufRead *.ml,*.mli,*.mll,*.mly,.ocamlinit,*.mlt,*.mlp,*.mlip,*.mli.cppo,*.ml.cppo setf ocaml @@ -1503,7 +1512,7 @@ au BufNewFile,BufRead *.nmconnection setf confini " Pacman hooks au BufNewFile,BufRead *.hook \ if getline(1) == '[Trigger]' | - \ setf conf | + \ setf confini | \ endif " Pam conf @@ -1998,9 +2007,8 @@ au BufNewFile,BufRead .tcshrc,*.tcsh,tcsh.tcshrc,tcsh.login call dist#ft#SetFile " (patterns ending in a start further below) au BufNewFile,BufRead .login,.cshrc,csh.cshrc,csh.login,csh.logout,*.csh,.alias call dist#ft#CSH() -" Zig and Zir (Zig Intermediate Representation) -au BufNewFile,BufRead *.zig setf zig -au BufNewFile,BufRead *.zir setf zir +" Zig and Zig Object Notation (ZON) +au BufNewFile,BufRead *.zig,*.zon setf zig " Zserio au BufNewFile,BufRead *.zs setf zserio @@ -2860,6 +2868,9 @@ au BufNewFile,BufRead XF86Config* \|endif \|call s:StarSetf('xf86conf') +" XKB +au BufNewFile,BufRead */usr/share/X11/xkb/{compat,geometry,keycodes,symbols,types}/* call s:StarSetf('xkb') + " X11 xmodmap au BufNewFile,BufRead *xmodmap* call s:StarSetf('xmodmap') diff --git a/runtime/ftplugin/awk.vim b/runtime/ftplugin/awk.vim index 785088ff9b..40fe304cf4 100644 --- a/runtime/ftplugin/awk.vim +++ b/runtime/ftplugin/awk.vim @@ -37,8 +37,8 @@ if exists("g:awk_is_gawk") let b:undo_ftplugin .= " | setl fp<" endif - " Disabled by default for security reasons. - if get(g:, 'awk_exec', get(g:, 'plugin_exec', 0)) + " Disabled by default for security reasons. + if dist#vim#IsSafeExecutable('awk', 'gawk') let path = system("gawk 'BEGIN { printf ENVIRON[\"AWKPATH\"] }'") let path = substitute(path, '^\.\=:\|:\.\=$\|:\.\=:', ',,', 'g') " POSIX cwd let path = substitute(path, ':', ',', 'g') diff --git a/runtime/ftplugin/changelog.vim b/runtime/ftplugin/changelog.vim index a62433378a..ab73949be5 100644 --- a/runtime/ftplugin/changelog.vim +++ b/runtime/ftplugin/changelog.vim @@ -57,8 +57,8 @@ if &filetype == 'changelog' endif let s:default_login = 'unknown' - " Disabled by default for security reasons. - if get(g:, 'changelog_exec', get(g:, 'plugin_exec', 0)) + " Disabled by default for security reasons. + if dist#vim#IsSafeExecutable('changelog', 'whoami') let login = s:login() else let login = s:default_login diff --git a/runtime/ftplugin/debchangelog.vim b/runtime/ftplugin/debchangelog.vim index dca7f7355a..aa657a9b97 100644 --- a/runtime/ftplugin/debchangelog.vim +++ b/runtime/ftplugin/debchangelog.vim @@ -3,7 +3,7 @@ " Maintainer: Debian Vim Maintainers " Former Maintainers: Michael Piefel " Stefano Zacchiroli -" Last Change: 2023 Jan 16 +" Last Change: 2023 Aug 18 " License: Vim License " URL: https://salsa.debian.org/vim-team/vim-debian/blob/main/ftplugin/debchangelog.vim diff --git a/runtime/ftplugin/debsources.vim b/runtime/ftplugin/debsources.vim new file mode 100644 index 0000000000..cbb4fafd22 --- /dev/null +++ b/runtime/ftplugin/debsources.vim @@ -0,0 +1,16 @@ +" Language: Debian sources.list +" Maintainer: Debian Vim Maintainers +" Last Change: 2023 Aug 30 +" License: Vim License +" URL: https://salsa.debian.org/vim-team/vim-debian/blob/main/ftplugin/debsources.vim + +if exists('b:did_ftplugin') + finish +endif +let b:did_ftplugin=1 + +setlocal comments=:# +setlocal commentstring=#%s +setlocal formatoptions-=t + +let b:undo_ftplugin = 'setlocal comments< commentstring< formatoptions<' diff --git a/runtime/ftplugin/json5.vim b/runtime/ftplugin/json5.vim new file mode 100644 index 0000000000..2560857a33 --- /dev/null +++ b/runtime/ftplugin/json5.vim @@ -0,0 +1,28 @@ +" Vim filetype plugin file +" Language: JSON5 +" Maintainer: Doug Kearns +" Last Change: 2023 Oct 19 + +if exists("b:did_ftplugin") + finish +endif +let b:did_ftplugin = 1 + +let s:cpo_save = &cpo +set cpo&vim + +setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,:// +setlocal commentstring=//\ %s +setlocal formatoptions-=t formatoptions+=croql + +let b:undo_ftplugin = "setl fo< com< cms<" + +if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") + let b:browsefilter = "JSON5 Files (*.json5)\t*.json5\n" .. + \ "JSON Files (*.json)\t*.json\n" .. + \ "All Files (*.*)\t*.*\n" + let b:undo_ftplugin ..= " | unlet! b:browsefilter" +endif + +let &cpo = s:cpo_save +unlet s:cpo_save diff --git a/runtime/ftplugin/objdump.vim b/runtime/ftplugin/objdump.vim new file mode 100644 index 0000000000..7517a342a3 --- /dev/null +++ b/runtime/ftplugin/objdump.vim @@ -0,0 +1,14 @@ +" Vim filetype plugin file +" Language: Objdump +" Maintainer: Colin Kennedy +" Last Change: 2023 October 25 + +if exists("b:did_ftplugin") + finish +endif + +let b:did_ftplugin = 1 + +let b:undo_ftplugin = "setlocal cms<" + +setlocal commentstring=#\ %s diff --git a/runtime/ftplugin/perl.vim b/runtime/ftplugin/perl.vim index 7ea0ae980a..c63bd3f9c7 100644 --- a/runtime/ftplugin/perl.vim +++ b/runtime/ftplugin/perl.vim @@ -56,12 +56,8 @@ endif " Set this once, globally. if !exists("perlpath") - let s:tmp_cwd = getcwd() " safety check: don't execute perl binary by default - if executable("perl") && get(g:, 'perl_exec', get(g:, 'plugin_exec', 0)) - \ && (fnamemodify(exepath("perl"), ":p:h") != s:tmp_cwd - \ || (index(split($PATH, has("win32") ? ';' : ':'), s:tmp_cwd) != -1 - \ && s:tmp_cwd != '.')) + if dist#vim#IsSafeExecutable('perl', 'perl') try if &shellxquote != '"' let perlpath = system('perl -e "print join(q/,/,@INC)"') @@ -77,7 +73,6 @@ if !exists("perlpath") " current directory and the directory of the current file. let perlpath = ".,," endif - unlet! s:tmp_cwd endif " Append perlpath to the existing path value, if it is set. Since we don't diff --git a/runtime/ftplugin/systemd.vim b/runtime/ftplugin/systemd.vim index 8bcacdd381..d268bfee7a 100644 --- a/runtime/ftplugin/systemd.vim +++ b/runtime/ftplugin/systemd.vim @@ -3,10 +3,11 @@ " Keyword Lookup Support: Enno Nagel " Latest Revision: 2023-10-07 -if !exists('b:did_ftplugin') - " Looks a lot like dosini files. - runtime! ftplugin/dosini.vim +if exists("b:did_ftplugin") + finish endif +" Looks a lot like dosini files. +runtime! ftplugin/dosini.vim if has('unix') && executable('less') if !has('gui_running') diff --git a/runtime/ftplugin/vim.vim b/runtime/ftplugin/vim.vim index e25054ba89..1d340e475b 100644 --- a/runtime/ftplugin/vim.vim +++ b/runtime/ftplugin/vim.vim @@ -85,8 +85,8 @@ if !exists("no_plugin_maps") && !exists("no_vim_maps") vnoremap ][ m':exe "normal! gv"call search('^\s*end\(f\%[unction]\\|\(export\s\+\)\?def\)\>', "W") " Move around comments - nnoremap ]" :call search('^\(\s*".*\n\)\@ - vnoremap ]" :exe "normal! gv"call search('^\(\s*".*\n\)\@ + nnoremap ]" :call search('\%(^\s*".*\n\)\@ + vnoremap ]" :exe "normal! gv"call search('\%(^\s*".*\n\)\@ nnoremap [" :call search('\%(^\s*".*\n\)\%(^\s*"\)\@!', "bW") vnoremap [" :exe "normal! gv"call search('\%(^\s*".*\n\)\%(^\s*"\)\@!', "bW") endif diff --git a/runtime/ftplugin/zig.vim b/runtime/ftplugin/zig.vim index cfd7102b8d..28b8cd5a67 100644 --- a/runtime/ftplugin/zig.vim +++ b/runtime/ftplugin/zig.vim @@ -28,7 +28,7 @@ setlocal formatoptions-=t formatoptions+=croql setlocal suffixesadd=.zig,.zir if has('comments') - setlocal comments=:///,://!,://,:\\\\ + setlocal comments=:///,://!,:// setlocal commentstring=//\ %s endif @@ -41,19 +41,16 @@ let &l:define='\v(|||^\s*\#\s*define)' " Safety check: don't execute zig from current directory if !exists('g:zig_std_dir') && exists('*json_decode') && - \ executable('zig') && get(g:, 'zig_exec', get(g:, 'plugin_exec', 0)) - \ && (fnamemodify(exepath("zig"), ":p:h") != s:tmp_cwd - \ || (index(split($PATH,has("win32")? ';' : ':'), s:tmp_cwd) != -1 && s:tmp_cwd != '.')) + \ executable('zig') && dist#vim#IsSafeExecutable('zig', 'zig') silent let s:env = system('zig env') if v:shell_error == 0 let g:zig_std_dir = json_decode(s:env)['std_dir'] endif unlet! s:env endif -unlet! s:tmp_cwd if exists('g:zig_std_dir') - let &l:path = &l:path . ',' . g:zig_std_dir + let &l:path = g:zig_std_dir . ',' . &l:path endif let b:undo_ftplugin = diff --git a/runtime/keymap/arabic_utf-8.vim b/runtime/keymap/arabic_utf-8.vim index aeb4a4f398..60fd05fc81 100644 --- a/runtime/keymap/arabic_utf-8.vim +++ b/runtime/keymap/arabic_utf-8.vim @@ -1,7 +1,7 @@ " Vim Keymap file for Arabic " Maintainer : Arabic Support group " Created by : Nadim Shaikli -" Last Updated : 2003 Apr 26 +" Last Updated : 2023-10-27 " This is for a standard Microsoft Arabic keyboard layout. " Use this short name in the status line. @@ -41,16 +41,6 @@ m " (1577) - TEH MARBUTA , " (1608) - WAW . " (1586) - ZAIN / " (1592) - ZAH -0 " (1632) - Arabic 0 -1 " (1633) - Arabic 1 -2 " (1634) - Arabic 2 -3 " (1635) - Arabic 3 -4 " (1636) - Arabic 4 -5 " (1637) - Arabic 5 -6 " (1638) - Arabic 6 -7 " (1639) - Arabic 7 -8 " (1640) - Arabic 8 -9 " (1641) - Arabic 9 ` " (1584) - THAL ~ " (1617) - Tanween -- SHADDA Q " (1614) - Tanween -- FATHA diff --git a/runtime/plugin/matchparen.vim b/runtime/plugin/matchparen.vim index b33ecd557c..9d57545ee8 100644 --- a/runtime/plugin/matchparen.vim +++ b/runtime/plugin/matchparen.vim @@ -1,6 +1,6 @@ " Vim plugin for showing matching parens " Maintainer: The Vim Project -" Last Change: 2023 Aug 10 +" Last Change: 2023 Oct 20 " Former Maintainer: Bram Moolenaar " Exit quickly when: @@ -18,6 +18,8 @@ if !exists("g:matchparen_insert_timeout") let g:matchparen_insert_timeout = 60 endif +let s:has_matchaddpos = exists('*matchaddpos') + augroup matchparen " Replace all matchparen autocommands autocmd! CursorMoved,CursorMovedI,WinEnter,BufWinEnter,WinScrolled * call s:Highlight_Matching_Pair() @@ -38,6 +40,9 @@ set cpo-=C " The function that is invoked (very often) to define a ":match" highlighting " for any matching paren. func s:Highlight_Matching_Pair() + if !exists("w:matchparen_ids") + let w:matchparen_ids = [] + endif " Remove any previous match. call s:Remove_Matches() @@ -185,11 +190,12 @@ func s:Highlight_Matching_Pair() " If a match is found setup match highlighting. if m_lnum > 0 && m_lnum >= stoplinetop && m_lnum <= stoplinebottom - if exists('*matchaddpos') - call matchaddpos('MatchParen', [[c_lnum, c_col - before], [m_lnum, m_col]], 10, 3) + if s:has_matchaddpos + call add(w:matchparen_ids, matchaddpos('MatchParen', [[c_lnum, c_col - before], [m_lnum, m_col]], 10)) else exe '3match MatchParen /\(\%' . c_lnum . 'l\%' . (c_col - before) . \ 'c\)\|\(\%' . m_lnum . 'l\%' . m_col . 'c\)/' + call add(w:matchparen_ids, 3) endif let w:paren_hl_on = 1 endif @@ -197,12 +203,13 @@ endfunction func s:Remove_Matches() if exists('w:paren_hl_on') && w:paren_hl_on - silent! call matchdelete(3) + while !empty(w:matchparen_ids) + silent! call remove(w:matchparen_ids, 0)->matchdelete() + endwhile let w:paren_hl_on = 0 endif endfunc - " Define commands that will disable and enable the plugin. command DoMatchParen call s:DoMatchParen() command NoMatchParen call s:NoMatchParen() diff --git a/runtime/syntax/deb822sources.vim b/runtime/syntax/deb822sources.vim new file mode 100644 index 0000000000..81113610e8 --- /dev/null +++ b/runtime/syntax/deb822sources.vim @@ -0,0 +1,63 @@ +" Vim syntax file +" Language: Debian deb822-format source list file +" Maintainer: Debian Vim Maintainers +" Last Change: 2023 May 25 +" URL: https://salsa.debian.org/vim-team/vim-debian/blob/main/syntax/deb822sources.vim + +" Standard syntax initialization +if exists('b:current_syntax') + finish +endif + +" case insensitive +syn case ignore + +" Comments are matched from the first character of a line to the end-of-line +syn region deb822sourcesComment start="^#" end="$" + +" A bunch of useful keywords +syn match deb822sourcesType /\(deb-src\|deb\)/ +syn match deb822sourcesFreeComponent /\(main\|universe\)/ +syn match deb822sourcesNonFreeComponent /\(contrib\|non-free-firmware\|non-free\|restricted\|multiverse\)/ + +" Include Debian versioning information +runtime! syntax/shared/debversions.vim + +exe 'syn match deb822sourcesSupportedSuites contained + *\([[:alnum:]_./]*\)\<\('. join(g:debSharedSupportedVersions, '\|'). '\)\>\([-[:alnum:]_./]*\)+' +exe 'syn match deb822sourcesUnsupportedSuites contained + *\([[:alnum:]_./]*\)\<\('. join(g:debSharedUnsupportedVersions, '\|'). '\)\>\([-[:alnum:]_./]*\)+' + +unlet g:debSharedSupportedVersions +unlet g:debSharedUnsupportedVersions + +syn region deb822sourcesSuites start="\(^Suites: *\)\@<=" end="$" contains=deb822sourcesSupportedSuites,deb822sourcesUnsupportedSuites oneline + +syn keyword deb822sourcesForce contained force +syn keyword deb822sourcesYesNo contained yes no + +" Match uri's +syn match deb822sourcesUri '\(https\?://\|ftp://\|[rs]sh://\|debtorrent://\|\(cdrom\|copy\|file\):\)[^' <>"]\+' + +syn match deb822sourcesEntryField "^\%(Types\|URIs\|Suites\|Components\): *" +syn match deb822sourcesOptionField "^\%(Signed-By\|Check-Valid-Until\|Valid-Until-Min\|Valid-Until-Max\|Date-Max-Future\|InRelease-Path\): *" +syn match deb822sourcesMultiValueOptionField "^\%(Architectures\|Languages\|Targets\)\%(-Add\|-Remove\)\?: *" + +syn region deb822sourcesStrictField matchgroup=deb822sourcesBooleanOptionField start="^\%(PDiffs\|Allow-Insecure\|Allow-Weak\|Allow-Downgrade-To-Insecure\|Trusted\|Check-Date\): *" end="$" contains=deb822sourcesYesNo oneline +syn region deb822sourcesStrictField matchgroup=deb822sourcesForceBooleanOptionField start="^\%(By-Hash\): *" end="$" contains=deb822sourcesForce,deb822sourcesYesNo oneline + +hi def link deb822sourcesComment Comment +hi def link deb822sourcesEntryField Keyword +hi def link deb822sourcesOptionField Special +hi def link deb822sourcesMultiValueOptionField Special +hi def link deb822sourcesBooleanOptionField Special +hi def link deb822sourcesForceBooleanOptionField Special +hi def link deb822sourcesStrictField Error +hi def link deb822sourcesType Identifier +hi def link deb822sourcesFreeComponent Identifier +hi def link deb822sourcesNonFreeComponent Identifier +hi def link deb822sourcesForce Identifier +hi def link deb822sourcesYesNo Identifier +hi def link deb822sourcesUri Constant +hi def link deb822sourcesSupportedSuites Type +hi def link deb822sourcesUnsupportedSuites WarningMsg + +let b:current_syntax = 'deb822sources' diff --git a/runtime/syntax/debchangelog.vim b/runtime/syntax/debchangelog.vim index d3c3d39304..da35a6a10b 100644 --- a/runtime/syntax/debchangelog.vim +++ b/runtime/syntax/debchangelog.vim @@ -3,7 +3,7 @@ " Maintainer: Debian Vim Maintainers " Former Maintainers: Gerfried Fuchs " Wichert Akkerman -" Last Change: 2023 Jan 16 +" Last Change: 2023 Oct 11 " URL: https://salsa.debian.org/vim-team/vim-debian/blob/main/syntax/debchangelog.vim " Standard syntax initialization @@ -17,34 +17,19 @@ syn case ignore let s:urgency='urgency=\(low\|medium\|high\|emergency\|critical\)\( [^[:space:],][^,]*\)\=' let s:binNMU='binary-only=yes' -let s:cpo = &cpo -set cpo-=C -let s:supported = [ - \ 'oldstable', 'stable', 'testing', 'unstable', 'experimental', 'sid', 'rc-buggy', - \ 'buster', 'bullseye', 'bookworm', 'trixie', 'forky', - \ - \ 'trusty', 'xenial', 'bionic', 'focal', 'jammy', 'kinetic', 'lunar', - \ 'devel' - \ ] -let s:unsupported = [ - \ 'frozen', 'buzz', 'rex', 'bo', 'hamm', 'slink', 'potato', - \ 'woody', 'sarge', 'etch', 'lenny', 'squeeze', 'wheezy', - \ 'jessie', 'stretch', - \ - \ 'warty', 'hoary', 'breezy', 'dapper', 'edgy', 'feisty', - \ 'gutsy', 'hardy', 'intrepid', 'jaunty', 'karmic', 'lucid', - \ 'maverick', 'natty', 'oneiric', 'precise', 'quantal', 'raring', 'saucy', - \ 'utopic', 'vivid', 'wily', 'yakkety', 'zesty', 'artful', 'cosmic', - \ 'disco', 'eoan', 'hirsute', 'impish', 'groovy' - \ ] -let &cpo=s:cpo +" Include Debian versioning information +runtime! syntax/shared/debversions.vim + +exe 'syn match debchangelogTarget contained "\%( \%('.join(g:debSharedSupportedVersions, '\|').'\)\>[-[:alnum:]]*\)\+"' +exe 'syn match debchangelogUnsupportedTarget contained "\%( \%('.join(g:debSharedUnsupportedVersions, '\|').'\)\>[-[:alnum:]]*\)\+"' + +unlet g:debSharedSupportedVersions +unlet g:debSharedUnsupportedVersions " Define some common expressions we can use later on syn match debchangelogName contained "^[[:alnum:]][[:alnum:].+-]\+ " exe 'syn match debchangelogFirstKV contained "; \('.s:urgency.'\|'.s:binNMU.'\)"' exe 'syn match debchangelogOtherKV contained ", \('.s:urgency.'\|'.s:binNMU.'\)"' -exe 'syn match debchangelogTarget contained "\%( \%('.join(s:supported, '\|').'\)\>[-[:alnum:]]*\)\+"' -exe 'syn match debchangelogUnsupportedTarget contained "\%( \%('.join(s:unsupported, '\|').'\)\>[-[:alnum:]]*\)\+"' syn match debchangelogUnreleased contained / UNRELEASED/ syn match debchangelogVersion contained "(.\{-})" syn match debchangelogCloses contained "closes:\_s*\(bug\)\=#\=\_s\=\d\+\(,\_s*\(bug\)\=#\=\_s\=\d\+\)*" @@ -58,19 +43,19 @@ syn region debchangelogFooter start="^ [^ ]" end="$" contains=debchangelogEmail syn region debchangelogEntry start="^ " end="$" contains=debchangelogCloses,debchangelogLP oneline " Associate our matches and regions with pretty colours -hi def link debchangelogHeader Error -hi def link debchangelogFooter Identifier -hi def link debchangelogEntry Normal -hi def link debchangelogCloses Statement -hi def link debchangelogLP Statement -hi def link debchangelogFirstKV Identifier -hi def link debchangelogOtherKV Identifier -hi def link debchangelogName Comment -hi def link debchangelogVersion Identifier -hi def link debchangelogTarget Identifier -hi def link debchangelogUnsupportedTarget Identifier +hi def link debchangelogHeader Error +hi def link debchangelogFooter Identifier +hi def link debchangelogEntry Normal +hi def link debchangelogCloses Statement +hi def link debchangelogLP Statement +hi def link debchangelogFirstKV Identifier +hi def link debchangelogOtherKV Identifier +hi def link debchangelogName Comment +hi def link debchangelogVersion Identifier hi def link debchangelogUnreleased WarningMsg -hi def link debchangelogEmail Special +hi def link debchangelogEmail Special +hi def link debchangelogTarget Identifier +hi def link debchangelogUnsupportedTarget Identifier let b:current_syntax = 'debchangelog' diff --git a/runtime/syntax/debsources.vim b/runtime/syntax/debsources.vim index cbb3b36c10..9846cfdef0 100644 --- a/runtime/syntax/debsources.vim +++ b/runtime/syntax/debsources.vim @@ -2,7 +2,7 @@ " Language: Debian sources.list " Maintainer: Debian Vim Maintainers " Former Maintainer: Matthijs Mohlmann -" Last Change: 2023 Feb 06 +" Last Change: 2023 Oct 11 " URL: https://salsa.debian.org/vim-team/vim-debian/blob/main/syntax/debsources.vim " Standard syntax initialization @@ -21,41 +21,27 @@ syn match debsourcesNonFreeComponent /\(contrib\|non-free-firmware\|non-free\| " Match comments syn match debsourcesComment /#.*/ contains=@Spell -let s:cpo = &cpo -set cpo-=C -let s:supported = [ - \ 'oldstable', 'stable', 'testing', 'unstable', 'experimental', 'sid', 'rc-buggy', - \ 'buster', 'bullseye', 'bookworm', 'trixie', 'forky', - \ - \ 'trusty', 'xenial', 'bionic', 'focal', 'jammy', 'kinetic', 'lunar', - \ 'devel' - \ ] -let s:unsupported = [ - \ 'buzz', 'rex', 'bo', 'hamm', 'slink', 'potato', - \ 'woody', 'sarge', 'etch', 'lenny', 'squeeze', 'wheezy', - \ 'jessie', 'stretch', - \ - \ 'warty', 'hoary', 'breezy', 'dapper', 'edgy', 'feisty', - \ 'gutsy', 'hardy', 'intrepid', 'jaunty', 'karmic', 'lucid', - \ 'maverick', 'natty', 'oneiric', 'precise', 'quantal', 'raring', 'saucy', - \ 'utopic', 'vivid', 'wily', 'yakkety', 'zesty', 'artful', 'cosmic', - \ 'disco', 'eoan', 'hirsute', 'impish', 'groovy' - \ ] -let &cpo=s:cpo +" Include Debian versioning information +runtime! syntax/shared/debversions.vim + +exe 'syn match debsourcesDistrKeyword +\([[:alnum:]_./]*\)\<\('. join(g:debSharedSupportedVersions, '\|'). '\)\>\([-[:alnum:]_./]*\)+' +exe 'syn match debsourcesUnsupportedDistrKeyword +\([[:alnum:]_./]*\)\<\('. join(g:debSharedUnsupportedVersions, '\|') .'\)\>\([-[:alnum:]_./]*\)+' + +unlet g:debSharedSupportedVersions +unlet g:debSharedUnsupportedVersions " Match uri's syn match debsourcesUri '\(https\?://\|ftp://\|[rs]sh://\|debtorrent://\|\(cdrom\|copy\|file\):\)[^' <>"]\+' -exe 'syn match debsourcesDistrKeyword +\([[:alnum:]_./]*\)\<\('. join(s:supported, '\|'). '\)\>\([-[:alnum:]_./]*\)+' -exe 'syn match debsourcesUnsupportedDistrKeyword +\([[:alnum:]_./]*\)\<\('. join(s:unsupported, '\|') .'\)\>\([-[:alnum:]_./]*\)+' +syn region debsourcesLine start="^" end="$" contains=debsourcesType,debsourcesFreeComponent,debsourcesNonFreeComponent,debsourcesComment,debsourcesUri,debsourcesDistrKeyword,debsourcesUnsupportedDistrKeyword oneline + " Associate our matches and regions with pretty colours -hi def link debsourcesLine Error hi def link debsourcesType Statement hi def link debsourcesFreeComponent Statement hi def link debsourcesNonFreeComponent Statement -hi def link debsourcesDistrKeyword Type -hi def link debsourcesUnsupportedDistrKeyword WarningMsg hi def link debsourcesComment Comment hi def link debsourcesUri Constant +hi def link debsourcesDistrKeyword Type +hi def link debsourcesUnsupportedDistrKeyword WarningMsg let b:current_syntax = 'debsources' diff --git a/runtime/syntax/sh.vim b/runtime/syntax/sh.vim index 8674ded9e4..e2b1947197 100644 --- a/runtime/syntax/sh.vim +++ b/runtime/syntax/sh.vim @@ -140,7 +140,7 @@ syn cluster shArithList contains=@shArithParenList,shParenError syn cluster shCaseEsacList contains=shCaseStart,shCaseLabel,shCase,shCaseBar,shCaseIn,shComment,shDeref,shDerefSimple,shCaseCommandSub,shCaseExSingleQuote,shCaseSingleQuote,shCaseDoubleQuote,shCtrlSeq,@shErrorList,shStringSpecial,shCaseRange syn cluster shCaseList contains=@shCommandSubList,shCaseEsac,shColon,shCommandSub,shCommandSubBQ,shComment,shDblBrace,shDo,shEcho,shExpr,shFor,shHereDoc,shIf,shHereString,shRedir,shSetList,shSource,shStatement,shVariable,shCtrlSeq if exists("b:is_kornshell") || exists("b:is_bash") - syn cluster shCaseList add=shForPP + syn cluster shCaseList add=shForPP,shDblParen endif syn cluster shCommandSubList contains=shAlias,shArithmetic,shCmdParenRegion,shCommandSub,shComment,shCtrlSeq,shDeref,shDerefSimple,shDoubleQuote,shEcho,shEscape,shExDoubleQuote,shExpr,shExSingleQuote,shHereDoc,shNumber,shOperator,shOption,shPosnParm,shHereString,shRedir,shSingleQuote,shSpecial,shStatement,shSubSh,shTest,shVariable syn cluster shCurlyList contains=shNumber,shComma,shDeref,shDerefSimple,shDerefSpecial @@ -163,7 +163,7 @@ syn cluster shIdList contains=shArithmetic,shCommandSub,shCommandSubBQ,shWrapLin syn cluster shIfList contains=@shLoopList,shDblBrace,shDblParen,shFunctionKey,shFunctionOne,shFunctionTwo syn cluster shLoopList contains=@shCaseList,@shErrorList,shCaseEsac,shConditional,shDblBrace,shExpr,shFor,shIf,shOption,shSet,shTest,shTestOpr,shTouch if exists("b:is_kornshell") || exists("b:is_bash") - syn cluster shLoopoList add=shForPP + syn cluster shLoopList add=shForPP,shDblParen endif syn cluster shPPSLeftList contains=shAlias,shArithmetic,shCmdParenRegion,shCommandSub,shCtrlSeq,shDeref,shDerefSimple,shDoubleQuote,shEcho,shEscape,shExDoubleQuote,shExpr,shExSingleQuote,shHereDoc,shNumber,shOperator,shOption,shPosnParm,shHereString,shRedir,shSingleQuote,shSpecial,shStatement,shSubSh,shTest,shVariable syn cluster shPPSRightList contains=shDeref,shDerefSimple,shEscape,shPosnParm @@ -531,7 +531,7 @@ if exists("b:is_kornshell") || exists("b:is_posix") endif " sh ksh bash : ${var[... ]...} array reference: {{{1 -syn region shDerefVarArray contained matchgroup=shDeref start="\[" end="]" contains=@shCommandSubList nextgroup=shDerefOp,shDerefOpError +syn region shDerefVarArray contained matchgroup=shDeref start="\[" end="]" contains=@shCommandSubList nextgroup=shDerefOp,shDerefOpError,shDerefOffset " Special ${parameter OPERATOR word} handling: {{{1 " sh ksh bash : ${parameter:-word} word is default value diff --git a/runtime/syntax/shared/debversions.vim b/runtime/syntax/shared/debversions.vim new file mode 100644 index 0000000000..6c944cd4e1 --- /dev/null +++ b/runtime/syntax/shared/debversions.vim @@ -0,0 +1,29 @@ +" Vim syntax file +" Language: Debian version information +" Maintainer: Debian Vim Maintainers +" Last Change: 2023 Nov 01 +" URL: https://salsa.debian.org/vim-team/vim-debian/blob/main/syntax/shared/debversions.vim + +let s:cpo = &cpo +set cpo-=C + +let g:debSharedSupportedVersions = [ + \ 'oldstable', 'stable', 'testing', 'unstable', 'experimental', 'sid', 'rc-buggy', + \ 'bullseye', 'bookworm', 'trixie', 'forky', + \ + \ 'trusty', 'xenial', 'bionic', 'focal', 'jammy', 'lunar', 'mantic', 'noble', + \ 'devel' + \ ] +let g:debSharedUnsupportedVersions = [ + \ 'buzz', 'rex', 'bo', 'hamm', 'slink', 'potato', + \ 'woody', 'sarge', 'etch', 'lenny', 'squeeze', 'wheezy', + \ 'jessie', 'stretch', 'buster', + \ + \ 'warty', 'hoary', 'breezy', 'dapper', 'edgy', 'feisty', + \ 'gutsy', 'hardy', 'intrepid', 'jaunty', 'karmic', 'lucid', + \ 'maverick', 'natty', 'oneiric', 'precise', 'quantal', 'raring', 'saucy', + \ 'utopic', 'vivid', 'wily', 'yakkety', 'zesty', 'artful', 'cosmic', + \ 'disco', 'eoan', 'hirsute', 'impish', 'kinetic', 'groovy' + \ ] + +let &cpo=s:cpo diff --git a/runtime/syntax/zig.vim b/runtime/syntax/zig.vim index e09b5e8815..121b0195b0 100644 --- a/runtime/syntax/zig.vim +++ b/runtime/syntax/zig.vim @@ -34,6 +34,7 @@ let s:zig_syntax_keywords = { \ , "usize" \ , "comptime_int" \ , "comptime_float" + \ , "c_char" \ , "c_short" \ , "c_ushort" \ , "c_int" @@ -96,6 +97,7 @@ let s:zig_syntax_keywords = { \ , "@atomicStore" \ , "@bitCast" \ , "@breakpoint" + \ , "@trap" \ , "@alignCast" \ , "@alignOf" \ , "@cDefine" @@ -107,6 +109,7 @@ let s:zig_syntax_keywords = { \ , "@cmpxchgStrong" \ , "@compileError" \ , "@compileLog" + \ , "@constCast" \ , "@ctz" \ , "@popCount" \ , "@divExact" @@ -126,9 +129,10 @@ let s:zig_syntax_keywords = { \ , "@unionInit" \ , "@frameAddress" \ , "@import" + \ , "@inComptime" \ , "@newStackCall" \ , "@asyncCall" - \ , "@intToPtr" + \ , "@ptrFromInt" \ , "@max" \ , "@min" \ , "@memcpy" @@ -145,7 +149,7 @@ let s:zig_syntax_keywords = { \ , "@panic" \ , "@prefetch" \ , "@ptrCast" - \ , "@ptrToInt" + \ , "@intFromPtr" \ , "@rem" \ , "@returnAddress" \ , "@setCold" @@ -169,25 +173,26 @@ let s:zig_syntax_keywords = { \ , "@subWithOverflow" \ , "@intCast" \ , "@floatCast" - \ , "@intToFloat" - \ , "@floatToInt" - \ , "@boolToInt" - \ , "@errSetCast" + \ , "@floatFromInt" + \ , "@intFromFloat" + \ , "@intFromBool" + \ , "@errorCast" \ , "@truncate" \ , "@typeInfo" \ , "@typeName" \ , "@TypeOf" \ , "@atomicRmw" - \ , "@intToError" - \ , "@errorToInt" - \ , "@intToEnum" - \ , "@enumToInt" + \ , "@errorFromInt" + \ , "@intFromError" + \ , "@enumFromInt" + \ , "@intFromEnum" \ , "@setAlignStack" \ , "@frame" \ , "@Frame" \ , "@frameSize" \ , "@bitReverse" \ , "@Vector" + \ , "@volatileCast" \ , "@sin" \ , "@cos" \ , "@tan" @@ -196,7 +201,7 @@ let s:zig_syntax_keywords = { \ , "@log" \ , "@log2" \ , "@log10" - \ , "@fabs" + \ , "@abs" \ , "@floor" \ , "@ceil" \ , "@trunc" diff --git a/src/Make_cyg_ming.mak b/src/Make_cyg_ming.mak index 98c86a6e77..7afb6e03ce 100644 --- a/src/Make_cyg_ming.mak +++ b/src/Make_cyg_ming.mak @@ -513,9 +513,6 @@ endif # RUBY DEF_GUI=-DFEAT_GUI_MSWIN -DFEAT_CLIPBOARD DEFINES=-DWIN32 -DWINVER=$(WINVER) -D_WIN32_WINNT=$(WINVER) \ -DHAVE_PATHDEF -DFEAT_$(FEATURES) -DHAVE_STDINT_H -ifeq ($(ARCH),x86-64) -DEFINES+=-DMS_WIN64 -endif #>>>>> end of choices ########################################################################### @@ -926,7 +923,7 @@ endif ifeq ($(CHANNEL),yes) OBJ += $(OUTDIR)/job.o $(OUTDIR)/channel.o -LIB += -lwsock32 -lws2_32 +LIB += -lws2_32 endif ifeq ($(DIRECTX),yes) diff --git a/src/Make_mvc.mak b/src/Make_mvc.mak index 618821d690..bc2516cd32 100644 --- a/src/Make_mvc.mak +++ b/src/Make_mvc.mak @@ -420,7 +420,6 @@ NBDEBUG_DEFS = -DNBDEBUG NBDEBUG_INCL = nbdebug.h NBDEBUG_SRC = nbdebug.c ! endif -NETBEANS_LIB = WSock32.lib ! endif # DirectWrite (DirectX) @@ -473,7 +472,7 @@ CHANNEL_PRO = proto/job.pro proto/channel.pro CHANNEL_OBJ = $(OBJDIR)/job.obj $(OBJDIR)/channel.obj CHANNEL_DEFS = -DFEAT_JOB_CHANNEL -DFEAT_IPV6 -DHAVE_INET_NTOP -NETBEANS_LIB = WSock32.lib Ws2_32.lib +NETBEANS_LIB = Ws2_32.lib !endif # need advapi32.lib for GetUserName() @@ -1273,7 +1272,7 @@ $(XPM_OBJ) $(OUTDIR)\version.obj $(LINKARGS2) $(VIM): $(VIM).exe $(OUTDIR): - if not exist $(OUTDIR)/nul mkdir $(OUTDIR) + if not exist $(OUTDIR)/nul mkdir $(OUTDIR:/=\) CFLAGS_INST = /nologo /O2 -DNDEBUG -DWIN32 -DWINVER=$(WINVER) -D_WIN32_WINNT=$(WINVER) $(CFLAGS_DEPR) diff --git a/src/auto/configure b/src/auto/configure index a7fb7f0249..fec8ef4c08 100755 --- a/src/auto/configure +++ b/src/auto/configure @@ -841,6 +841,7 @@ with_luajit enable_mzschemeinterp with_plthome enable_perlinterp +with_xsubpp enable_pythoninterp with_python_command with_python_config_dir @@ -1581,6 +1582,7 @@ Optional Packages: --with-lua-prefix=PFX Prefix where Lua is installed. --with-luajit Link with LuaJIT instead of Lua. --with-plthome=PLTHOME Use PLTHOME. + --with-xsubpp=PATH path to the xsubpp command --with-python-command=NAME name of the Python 2 command (default: python2 or python) --with-python-config-dir=PATH Python's config directory (deprecated) --with-python3-command=NAME name of the Python 3 command (default: python3 or python) @@ -6602,12 +6604,42 @@ printf "%s\n" "OK" >&6; } vi_cv_perlsitelib=`$vi_cv_path_perl -MConfig -e 'print $Config{sitelibexp}'` vi_cv_perl_extutils=unknown_perl_extutils_path - for extutils_rel_path in ExtUtils vendor_perl/ExtUtils; do - xsubpp_path="$vi_cv_perllib/$extutils_rel_path/xsubpp" - if test -f "$xsubpp_path"; then - vi_cv_perl_xsubpp="$xsubpp_path" - fi - done + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking --with-xsubpp path" >&5 +printf %s "checking --with-xsubpp path... " >&6; } + vi_cv_perl_xsubpp= + +# Check whether --with-xsubpp was given. +if test ${with_xsubpp+y} +then : + withval=$with_xsubpp; + if test -f "$withval" + then + vi_cv_perl_xsubpp="$withval" + fi + +fi + + + if test "x$vi_cv_perl_xsubpp" = "x" + then + for extutils_rel_path in ExtUtils vendor_perl/ExtUtils; do + xsubpp_path="$vi_cv_perllib/$extutils_rel_path/xsubpp" + if test -f "$xsubpp_path"; then + vi_cv_perl_xsubpp="$xsubpp_path" + fi + done + fi + + if test "x$vi_cv_perl_xsubpp" = "x" + then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: empty" >&5 +printf "%s\n" "empty" >&6; } + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $vi_cv_perl_xsubpp" >&5 +printf "%s\n" "$vi_cv_perl_xsubpp" >&6; } + fi + perlcppflags=`$vi_cv_path_perl -Mlib=$srcdir -MExtUtils::Embed \ diff --git a/src/channel.c b/src/channel.c index e5c76ebb02..704dc6e524 100644 --- a/src/channel.c +++ b/src/channel.c @@ -10,13 +10,6 @@ * Implements communication through a socket or any file handle. */ -#ifdef WIN32 -// Must include winsock2.h before windows.h since it conflicts with winsock.h -// (included in windows.h). -# include -# include -#endif - #include "vim.h" #if defined(FEAT_JOB_CHANNEL) || defined(PROTO) diff --git a/src/cmdhist.c b/src/cmdhist.c index d398ca7a68..96a9b3e95b 100644 --- a/src/cmdhist.c +++ b/src/cmdhist.c @@ -742,7 +742,10 @@ ex_history(exarg_T *eap) end = arg; if (!get_list_range(&end, &hisidx1, &hisidx2) || *end != NUL) { - semsg(_(e_trailing_characters_str), end); + if (*end != NUL) + semsg(_(e_trailing_characters_str), end); + else + semsg(_(e_val_too_large), arg); return; } diff --git a/src/configure.ac b/src/configure.ac index 69f2964571..b25fb7e104 100644 --- a/src/configure.ac +++ b/src/configure.ac @@ -1233,14 +1233,35 @@ if test "$enable_perlinterp" = "yes" -o "$enable_perlinterp" = "dynamic"; then vi_cv_perlsitelib=`$vi_cv_path_perl -MConfig -e 'print $Config{sitelibexp}'` AC_SUBST(vi_cv_perllib) vi_cv_perl_extutils=unknown_perl_extutils_path - for extutils_rel_path in ExtUtils vendor_perl/ExtUtils; do - xsubpp_path="$vi_cv_perllib/$extutils_rel_path/xsubpp" - if test -f "$xsubpp_path"; then - vi_cv_perl_xsubpp="$xsubpp_path" - fi - done + + AC_MSG_CHECKING(--with-xsubpp path) + vi_cv_perl_xsubpp= + AC_ARG_WITH(xsubpp, [ --with-xsubpp=PATH path to the xsubpp command], [ + if test -f "$withval" + then + vi_cv_perl_xsubpp="$withval" + fi + ]) + + if test "x$vi_cv_perl_xsubpp" = "x" + then + for extutils_rel_path in ExtUtils vendor_perl/ExtUtils; do + xsubpp_path="$vi_cv_perllib/$extutils_rel_path/xsubpp" + if test -f "$xsubpp_path"; then + vi_cv_perl_xsubpp="$xsubpp_path" + fi + done + fi + + if test "x$vi_cv_perl_xsubpp" = "x" + then + AC_MSG_RESULT(empty) + else + AC_MSG_RESULT($vi_cv_perl_xsubpp) + fi AC_SUBST(vi_cv_perl_xsubpp) AC_SUBST(vi_cv_perlsitelib) + dnl Remove "-fno-something", it breaks using cproto. dnl Remove "-fdebug-prefix-map", it isn't supported by clang. dnl Remove "FORTIFY_SOURCE", it will be defined twice. diff --git a/src/digraph.c b/src/digraph.c index fb45c15248..0a4a4a3b41 100644 --- a/src/digraph.c +++ b/src/digraph.c @@ -853,6 +853,7 @@ static digr_T digraphdefault[] = { {'1', '\'', 0x2032}, {'2', '\'', 0x2033}, {'3', '\'', 0x2034}, + {'4', '\'', 0x2057}, {'1', '"', 0x2035}, {'2', '"', 0x2036}, {'3', '"', 0x2037}, diff --git a/src/edit.c b/src/edit.c index 5bd5ae0842..6f6d71b1f4 100644 --- a/src/edit.c +++ b/src/edit.c @@ -174,9 +174,6 @@ edit( return FALSE; } ins_compl_clear(); // clear stuff for CTRL-X mode - // Reset Changedtick_i, so that TextChangedI will only be triggered for stuff - // from insert mode - curbuf->b_last_changedtick_i = CHANGEDTICK(curbuf); /* * Trigger InsertEnter autocommands. Do not do this for "r" or "grx". diff --git a/src/errors.h b/src/errors.h index af179d6c01..155d5fb048 100644 --- a/src/errors.h +++ b/src/errors.h @@ -3389,21 +3389,21 @@ EXTERN char e_invalid_object_variable_declaration_str[] EXTERN char e_not_valid_command_in_class_str[] INIT(= N_("E1318: Not a valid command in a class: %s")); EXTERN char e_using_class_as_number[] - INIT(= N_("E1319: Using a class as a Number")); + INIT(= N_("E1319: Using a Class as a Number")); EXTERN char e_using_object_as_number[] - INIT(= N_("E1320: Using an object as a Number")); + INIT(= N_("E1320: Using an Object as a Number")); EXTERN char e_using_class_as_float[] - INIT(= N_("E1321: Using a class as a Float")); + INIT(= N_("E1321: Using a Class as a Float")); EXTERN char e_using_object_as_float[] - INIT(= N_("E1322: Using an object as a Float")); + INIT(= N_("E1322: Using an Object as a Float")); EXTERN char e_using_class_as_string[] - INIT(= N_("E1323: Using a class as a String")); + INIT(= N_("E1323: Using a Class as a String")); EXTERN char e_using_object_as_string[] - INIT(= N_("E1324: Using an object as a String")); + INIT(= N_("E1324: Using an Object as a String")); EXTERN char e_method_not_found_on_class_str_str[] - INIT(= N_("E1325: Method not found on class \"%s\": %s")); + INIT(= N_("E1325: Method \"%s\" not found in class \"%s\"")); EXTERN char e_variable_not_found_on_object_str_str[] - INIT(= N_("E1326: Variable not found on object \"%s\": %s")); + INIT(= N_("E1326: Variable \"%s\" not found in object \"%s\"")); EXTERN char e_object_required_found_str[] INIT(= N_("E1327: Object required, found %s")); EXTERN char e_constructor_default_value_must_be_vnone_str[] @@ -3499,8 +3499,8 @@ EXTERN char e_duplicate_variable_str[] INIT(= N_("E1369: Duplicate variable: %s")); EXTERN char e_cannot_define_new_method_as_static[] INIT(= N_("E1370: Cannot define a \"new\" method as static")); -EXTERN char e_abstract_must_be_followed_by_def_or_static[] - INIT(= N_("E1371: Abstract must be followed by \"def\" or \"static\"")); +EXTERN char e_abstract_must_be_followed_by_def[] + INIT(= N_("E1371: Abstract must be followed by \"def\"")); EXTERN char e_abstract_method_in_concrete_class[] INIT(= N_("E1372: Abstract method \"%s\" cannot be defined in a concrete class")); EXTERN char e_abstract_method_str_not_found[] @@ -3543,8 +3543,32 @@ EXTERN char e_cannot_lock_object_variable_str[] INIT(= N_("E1391: Cannot (un)lock variable \"%s\" in class \"%s\"")); EXTERN char e_cannot_lock_class_variable_str[] INIT(= N_("E1392: Cannot (un)lock class variable \"%s\" in class \"%s\"")); -#endif -// E1393 - E1499 unused (reserved for Vim9 class support) +EXTERN char e_type_can_only_be_defined_in_vim9_script[] + INIT(= N_("E1393: Type can only be defined in Vim9 script")); +EXTERN char e_type_name_must_start_with_uppercase_letter_str[] + INIT(= N_("E1394: Type name must start with an uppercase letter: %s")); +EXTERN char e_cannot_modify_typealias[] + INIT(= N_("E1395: Type alias \"%s\" cannot be modified")); +EXTERN char e_typealias_already_exists_for_str[] + INIT(= N_("E1396: Type alias \"%s\" already exists")); +EXTERN char e_missing_typealias_name[] + INIT(= N_("E1397: Missing type alias name")); +EXTERN char e_missing_typealias_type[] + INIT(= N_("E1398: Missing type alias type")); +EXTERN char e_type_can_only_be_used_in_script[] + INIT(= N_("E1399: Type can only be used in a script")); +EXTERN char e_using_typealias_as_number[] + INIT(= N_("E1400: Using type alias \"%s\" as a Number")); +EXTERN char e_using_typealias_as_float[] + INIT(= N_("E1401: Using type alias \"%s\" as a Float")); +EXTERN char e_using_typealias_as_string[] + INIT(= N_("E1402: Using type alias \"%s\" as a String")); +EXTERN char e_using_typealias_as_value[] + INIT(= N_("E1403: Type alias \"%s\" cannot be used as a value")); +EXTERN char e_abstract_cannot_be_used_in_interface[] + INIT(= N_("E1404: Abstract cannot be used in an interface")); +#endif +// E1405 - E1499 unused (reserved for Vim9 class support) EXTERN char e_cannot_mix_positional_and_non_positional_str[] INIT(= N_("E1500: Cannot mix positional and non-positional arguments: %s")); EXTERN char e_fmt_arg_nr_unused_str[] @@ -3565,3 +3589,5 @@ EXTERN char e_xattr_e2big[] INIT(= N_("E1508: Size of the extended attribute value is larger than the maximum size allowed")); EXTERN char e_xattr_other[] INIT(= N_("E1509: Error occurred when reading or writing extended attribute")); +EXTERN char e_val_too_large[] + INIT(= N_("E1510: Value too large: %s")); diff --git a/src/eval.c b/src/eval.c index e888fecc8a..ea57cde663 100644 --- a/src/eval.c +++ b/src/eval.c @@ -1883,6 +1883,14 @@ set_var_lval( if (eval_variable(lp->ll_name, (int)STRLEN(lp->ll_name), lp->ll_sid, &tv, &di, EVAL_VAR_VERBOSE) == OK) { + if (di != NULL && di->di_tv.v_type == VAR_TYPEALIAS) + { + semsg(_(e_cannot_modify_typealias), + di->di_tv.vval.v_typealias->ta_name); + clear_tv(&tv); + return; + } + if ((di == NULL || (!var_check_ro(di->di_flags, lp->ll_name, FALSE) && !tv_check_lock(&di->di_tv, lp->ll_name, FALSE))) @@ -2013,6 +2021,7 @@ tv_op(typval_T *tv1, typval_T *tv2, char_u *op) case VAR_INSTR: case VAR_CLASS: case VAR_OBJECT: + case VAR_TYPEALIAS: break; case VAR_BLOB: @@ -4036,7 +4045,8 @@ eval8( if (!equal_type(want_type, actual, 0)) { - if (want_type == &t_bool && actual != &t_bool + if (want_type->tt_type == VAR_BOOL + && actual->tt_type != VAR_BOOL && (actual->tt_flags & TTFLAG_BOOL_OK)) { int n = tv2bool(rettv); @@ -5004,6 +5014,7 @@ check_can_index(typval_T *rettv, int evaluate, int verbose) case VAR_INSTR: case VAR_CLASS: case VAR_OBJECT: + case VAR_TYPEALIAS: if (verbose) emsg(_(e_cannot_index_special_variable)); return FAIL; @@ -5109,6 +5120,7 @@ eval_index_inner( case VAR_INSTR: case VAR_CLASS: case VAR_OBJECT: + case VAR_TYPEALIAS: break; // not evaluating, skipping over subscript case VAR_NUMBER: @@ -6046,6 +6058,7 @@ set_ref_in_item( case VAR_FLOAT: case VAR_STRING: case VAR_BLOB: + case VAR_TYPEALIAS: case VAR_INSTR: // Types that do not contain any other item break; @@ -6329,6 +6342,13 @@ echo_string_core( *tofree = NULL; r = (char_u *)get_var_special_name(tv->vval.v_number); break; + + case VAR_TYPEALIAS: + *tofree = vim_strsave(tv->vval.v_typealias->ta_name); + r = *tofree; + if (r == NULL) + r = (char_u *)""; + break; } if (--recurse == 0) @@ -7201,6 +7221,7 @@ item_copy( case VAR_INSTR: case VAR_CLASS: case VAR_OBJECT: + case VAR_TYPEALIAS: copy_tv(from, to); break; case VAR_LIST: diff --git a/src/evalfunc.c b/src/evalfunc.c index 0227a125a9..a2e013eb16 100644 --- a/src/evalfunc.c +++ b/src/evalfunc.c @@ -3893,6 +3893,12 @@ f_empty(typval_T *argvars, typval_T *rettv) || !channel_is_open(argvars[0].vval.v_channel); break; #endif + case VAR_TYPEALIAS: + n = argvars[0].vval.v_typealias == NULL + || argvars[0].vval.v_typealias->ta_name == NULL + || *argvars[0].vval.v_typealias->ta_name == NUL; + break; + case VAR_UNKNOWN: case VAR_ANY: case VAR_VOID: @@ -7577,6 +7583,7 @@ f_len(typval_T *argvars, typval_T *rettv) case VAR_INSTR: case VAR_CLASS: case VAR_OBJECT: + case VAR_TYPEALIAS: emsg(_(e_invalid_type_for_len)); break; } @@ -9761,6 +9768,12 @@ f_setenv(typval_T *argvars, typval_T *rettv UNUSED) if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL) return; + // seting an environment variable may be dangerous, e.g. you could + // setenv GCONV_PATH=/tmp and then have iconv() unexpectedly call + // a shell command using some shared library: + if (check_restricted() || check_secure()) + return; + name = tv_get_string_buf(&argvars[0], namebuf); if (argvars[1].v_type == VAR_SPECIAL && argvars[1].vval.v_number == VVAL_NULL) @@ -10917,6 +10930,7 @@ f_type(typval_T *argvars, typval_T *rettv) case VAR_INSTR: n = VAR_TYPE_INSTR; break; case VAR_CLASS: n = VAR_TYPE_CLASS; break; case VAR_OBJECT: n = VAR_TYPE_OBJECT; break; + case VAR_TYPEALIAS: n = VAR_TYPE_TYPEALIAS; break; case VAR_UNKNOWN: case VAR_ANY: case VAR_VOID: diff --git a/src/evalvars.c b/src/evalvars.c index 952df6fc30..39a4bd39ed 100644 --- a/src/evalvars.c +++ b/src/evalvars.c @@ -158,6 +158,7 @@ static struct vimvar {VV_NAME("sizeofpointer", VAR_NUMBER), NULL, VV_RO}, {VV_NAME("maxcol", VAR_NUMBER), NULL, VV_RO}, {VV_NAME("python3_version", VAR_NUMBER), NULL, VV_RO}, + {VV_NAME("t_typealias", VAR_NUMBER), NULL, VV_RO}, // MacVim-specific value go here {VV_NAME("os_appearance", VAR_NUMBER), NULL, VV_RO}, }; @@ -262,6 +263,7 @@ evalvars_init(void) set_vim_var_nr(VV_TYPE_BLOB, VAR_TYPE_BLOB); set_vim_var_nr(VV_TYPE_CLASS, VAR_TYPE_CLASS); set_vim_var_nr(VV_TYPE_OBJECT, VAR_TYPE_OBJECT); + set_vim_var_nr(VV_TYPE_TYPEALIAS, VAR_TYPE_TYPEALIAS); set_vim_var_nr(VV_ECHOSPACE, sc_col - 1); @@ -1836,6 +1838,12 @@ ex_let_one( return NULL; } + if (tv->v_type == VAR_TYPEALIAS) + { + semsg(_(e_using_typealias_as_value), tv->vval.v_typealias->ta_name); + return NULL; + } + if (*arg == '$') { // ":let $VAR = expr": Set environment variable. @@ -2333,6 +2341,7 @@ item_lock(typval_T *tv, int deep, int lock, int check_refcount) case VAR_INSTR: case VAR_CLASS: case VAR_OBJECT: + case VAR_TYPEALIAS: break; case VAR_BLOB: @@ -3000,7 +3009,7 @@ eval_variable( } // Check for local variable when debugging. - if ((tv = lookup_debug_var(name)) == NULL) + if ((sid == 0) && (tv = lookup_debug_var(name)) == NULL) { // Check for user-defined variables. dictitem_T *v = find_var(name, &ht, flags & EVAL_VAR_NOAUTOLOAD); @@ -3116,6 +3125,25 @@ eval_variable( } } + if ((tv->v_type == VAR_TYPEALIAS || tv->v_type == VAR_CLASS) + && sid != 0) + { + // type alias or class imported from another script. Check + // whether it is exported from the other script. + sv = find_typval_in_script(tv, sid, TRUE); + if (sv == NULL) + { + ret = FAIL; + goto done; + } + if ((sv->sv_flags & SVFLAG_EXPORTED) == 0) + { + semsg(_(e_item_not_exported_in_script_str), name); + ret = FAIL; + goto done; + } + } + // If a list or dict variable wasn't initialized and has meaningful // type, do it now. Not for global variables, they are not // declared. @@ -3164,6 +3192,7 @@ eval_variable( } } +done: if (len > 0) name[len] = cc; @@ -3950,6 +3979,14 @@ set_var_const( goto failed; } + if (di->di_tv.v_type == VAR_TYPEALIAS) + { + semsg(_(e_cannot_modify_typealias), + di->di_tv.vval.v_typealias->ta_name); + clear_tv(&di->di_tv); + goto failed; + } + if (var_in_vim9script && (flags & ASSIGN_FOR_LOOP) == 0) { where_T where = WHERE_INIT; diff --git a/src/ex_eval.c b/src/ex_eval.c index 68dc6d78ca..79e9d94359 100644 --- a/src/ex_eval.c +++ b/src/ex_eval.c @@ -747,6 +747,48 @@ finish_exception(except_T *excp) discard_exception(excp, TRUE); } +/* + * Save the current exception state in "estate" + */ + void +exception_state_save(exception_state_T *estate) +{ + estate->estate_current_exception = current_exception; + estate->estate_did_throw = did_throw; + estate->estate_need_rethrow = need_rethrow; + estate->estate_trylevel = trylevel; + estate->estate_did_emsg = did_emsg; +} + +/* + * Restore the current exception state from "estate" + */ + void +exception_state_restore(exception_state_T *estate) +{ + // Handle any outstanding exceptions before restoring the state + if (did_throw) + handle_did_throw(); + current_exception = estate->estate_current_exception; + did_throw = estate->estate_did_throw; + need_rethrow = estate->estate_need_rethrow; + trylevel = estate->estate_trylevel; + did_emsg = estate->estate_did_emsg; +} + +/* + * Clear the current exception state + */ + void +exception_state_clear(void) +{ + current_exception = NULL; + did_throw = FALSE; + need_rethrow = FALSE; + trylevel = 0; + did_emsg = 0; +} + /* * Flags specifying the message displayed by report_pending. */ diff --git a/src/ex_getln.c b/src/ex_getln.c index 7d83573c94..c58b011227 100644 --- a/src/ex_getln.c +++ b/src/ex_getln.c @@ -4389,6 +4389,10 @@ get_list_range(char_u **str, int *num1, int *num2) { vim_str2nr(*str, NULL, &len, 0, &num, NULL, 0, FALSE, NULL); *str += len; + // overflow + if (num > INT_MAX) + return FAIL; + *num1 = (int)num; first = TRUE; } @@ -4399,8 +4403,12 @@ get_list_range(char_u **str, int *num1, int *num2) vim_str2nr(*str, NULL, &len, 0, &num, NULL, 0, FALSE, NULL); if (len > 0) { - *num2 = (int)num; *str = skipwhite(*str + len); + // overflow + if (num > INT_MAX) + return FAIL; + + *num2 = (int)num; } else if (!first) // no number given at all return FAIL; diff --git a/src/getchar.c b/src/getchar.c index fe6ed76488..5bb1a6ed5c 100644 --- a/src/getchar.c +++ b/src/getchar.c @@ -2524,7 +2524,7 @@ check_simplify_modifier(int max_offset) * modifyOtherKeys level 2 is enabled or the kitty keyboard protocol is * enabled. */ - static int + int key_protocol_enabled(void) { // If xterm has responded to XTQMODKEYS it overrules seenModifyOtherKeys. diff --git a/src/if_perl.xs b/src/if_perl.xs index 312262ae3f..dd504d384b 100644 --- a/src/if_perl.xs +++ b/src/if_perl.xs @@ -24,17 +24,6 @@ # define _USE_32BIT_TIME_T #endif -/* - * Prevent including winsock.h. perl.h tries to detect whether winsock.h is - * already included before including winsock2.h, because winsock2.h isn't - * compatible with winsock.h. However the detection doesn't work with some - * versions of MinGW. If WIN32_LEAN_AND_MEAN is defined, windows.h will not - * include winsock.h. - */ -#ifdef WIN32 -# define WIN32_LEAN_AND_MEAN -#endif - #include "vim.h" #ifdef _MSC_VER @@ -46,6 +35,11 @@ # define NO_THREAD_SAFE_LOCALE #endif +#if defined(MSWIN) && defined(DYNAMIC_PERL) +// Work around for warning C4273 (inconsistent DLL linkage). +# define PERL_EXT_RE_BUILD +#endif + #ifdef __GNUC__ # pragma GCC diagnostic push # pragma GCC diagnostic ignored "-Wunused-variable" @@ -1483,7 +1477,7 @@ vim_IOLayer_init(void) # if (PERL_REVISION == 5) && (PERL_VERSION >= 18) # undef Perl_sv_free2 -void Perl_sv_free2(pTHX_ SV* sv, const U32 refcnt) +void Perl_sv_free2(pTHX_ SV *const sv, const U32 refcnt) { (*dll_Perl_sv_free2)(aTHX_ sv, refcnt); } @@ -1519,7 +1513,7 @@ NV Perl_sv_2nv_flags(pTHX_ SV *const sv, const I32 flags) # ifdef PERL589_OR_LATER # undef Perl_sv_2iv_flags -IV Perl_sv_2iv_flags(pTHX_ SV* sv, I32 flags) +IV Perl_sv_2iv_flags(pTHX_ SV *const sv, const I32 flags) { return (*dll_Perl_sv_2iv_flags)(aTHX_ sv, flags); } diff --git a/src/if_py_both.h b/src/if_py_both.h index 06201711f6..f8438639e6 100644 --- a/src/if_py_both.h +++ b/src/if_py_both.h @@ -6772,6 +6772,7 @@ ConvertToPyObject(typval_T *tv) case VAR_INSTR: case VAR_CLASS: case VAR_OBJECT: + case VAR_TYPEALIAS: Py_INCREF(Py_None); return Py_None; case VAR_BOOL: diff --git a/src/if_python3.c b/src/if_python3.c index c39f42a6c7..c135e7e6fd 100644 --- a/src/if_python3.c +++ b/src/if_python3.c @@ -848,8 +848,9 @@ py3_get_system_libname(const char *libname) break; major = wcstol(keyname, &wp, 10); - if (*wp == L'.') - minor = wcstol(wp + 1, &wp, 10); + if (*wp != L'.') + continue; + minor = wcstol(wp + 1, &wp, 10); # ifdef _WIN64 if (*wp != L'\0') continue; diff --git a/src/insexpand.c b/src/insexpand.c index 108b1a67b8..b6bf226d87 100644 --- a/src/insexpand.c +++ b/src/insexpand.c @@ -3048,14 +3048,44 @@ ins_compl_update_sequence_numbers(void) info_add_completion_info(list_T *li) { compl_T *match; + int forward = compl_dir_forward(); if (compl_first_match == NULL) return OK; + match = compl_first_match; + // There are four cases to consider here: + // 1) when just going forward through the menu, + // compl_first_match should point to the initial entry with + // number zero and CP_ORIGINAL_TEXT flag set + // 2) when just going backwards, + // compl-first_match should point to the last entry before + // the entry with the CP_ORIGINAL_TEXT flag set + // 3) when first going forwards and then backwards, e.g. + // pressing C-N, C-P, compl_first_match points to the + // last entry before the entry with the CP_ORIGINAL_TEXT + // flag set and next-entry moves opposite through the list + // compared to case 2, so pretend the direction is forward again + // 4) when first going backwards and then forwards, e.g. + // pressing C-P, C-N, compl_first_match points to the + // first entry with the CP_ORIGINAL_TEXT + // flag set and next-entry moves in opposite direction through the list + // compared to case 1, so pretend the direction is backwards again + // + // But only do this when the 'noselect' option is not active! + + if (!compl_no_select) + { + if (forward && !match_at_original_text(match)) + forward = FALSE; + else if (!forward && match_at_original_text(match)) + forward = TRUE; + } + // Skip the element with the CP_ORIGINAL_TEXT flag at the beginning, in case of // forward completion, or at the end, in case of backward completion. - match = compl_dir_forward() - ? compl_first_match->cp_next : compl_first_match->cp_prev->cp_prev; + match = forward ? match->cp_next : (compl_no_select && match_at_original_text(match) ? match->cp_prev : match->cp_prev->cp_prev); + while (match != NULL && !match_at_original_text(match)) { dict_T *di = dict_alloc(); @@ -3075,7 +3105,7 @@ info_add_completion_info(list_T *li) else dict_add_tv(di, "user_data", &match->cp_user_data); - match = compl_dir_forward() ? match->cp_next : match->cp_prev; + match = forward ? match->cp_next : match->cp_prev; } return OK; diff --git a/src/iscygpty.c b/src/iscygpty.c index 9dded85485..9976f067c7 100644 --- a/src/iscygpty.c +++ b/src/iscygpty.c @@ -2,7 +2,7 @@ * iscygpty.c -- part of ptycheck * https://github.com/k-takata/ptycheck * - * Copyright (c) 2015-2017 K.Takata + * Copyright (c) 2015-2023 K.Takata * * You can redistribute it and/or modify it under the terms of either * the MIT license (as described below) or the Vim license. @@ -116,7 +116,7 @@ int is_cygpty(int fd) return 0; #else HANDLE h; - int size = sizeof(FILE_NAME_INFO) + sizeof(WCHAR) * (MAX_PATH - 1); + const int size = sizeof(FILE_NAME_INFO) + sizeof(WCHAR) * (MAX_PATH - 1); FILE_NAME_INFO *nameinfo; WCHAR *p = NULL; @@ -135,7 +135,7 @@ int is_cygpty(int fd) return 0; } // Check the name of the pipe: - // '\{cygwin,msys}-XXXXXXXXXXXXXXXX-ptyN-{from,to}-master' + // "\\{cygwin,msys}-XXXXXXXXXXXXXXXX-ptyN-{from,to}-master" if (pGetFileInformationByHandleEx(h, FileNameInfo, nameinfo, size)) { nameinfo->FileName[nameinfo->FileNameLength / sizeof(WCHAR)] = L'\0'; p = nameinfo->FileName; @@ -147,7 +147,8 @@ int is_cygpty(int fd) p = NULL; } if (p != NULL) { - while (*p && isxdigit(*p)) // Skip 16-digit hexadecimal. + // Skip 16-digit hexadecimal. + while (*p && iswascii(*p) && isxdigit(*p)) ++p; if (is_wprefix(p, L"-pty")) { p += 4; @@ -156,7 +157,8 @@ int is_cygpty(int fd) } } if (p != NULL) { - while (*p && isdigit(*p)) // Skip pty number. + // Skip pty number. + while (*p && iswascii(*p) && isdigit(*p)) ++p; if (is_wprefix(p, L"-from-master")) { //p += 12; diff --git a/src/json.c b/src/json.c index e2a011309c..66b8bf9d14 100644 --- a/src/json.c +++ b/src/json.c @@ -310,6 +310,7 @@ json_encode_item(garray_T *gap, typval_T *val, int copyID, int options) case VAR_INSTR: case VAR_CLASS: case VAR_OBJECT: + case VAR_TYPEALIAS: semsg(_(e_cannot_json_encode_str), vartype_name(val->v_type)); return FAIL; diff --git a/src/normal.c b/src/normal.c index 7e942d05d0..64345b2e45 100644 --- a/src/normal.c +++ b/src/normal.c @@ -6307,6 +6307,8 @@ n_opencmd(cmdarg_T *cap) (void)hasFolding(curwin->w_cursor.lnum, NULL, &curwin->w_cursor.lnum); #endif + // trigger TextChangedI for the 'o/O' command + curbuf->b_last_changedtick_i = CHANGEDTICK(curbuf); if (u_save((linenr_T)(curwin->w_cursor.lnum - (cap->cmdchar == 'O' ? 1 : 0)), (linenr_T)(curwin->w_cursor.lnum + @@ -7098,6 +7100,10 @@ invoke_edit( // Always reset "restart_edit", this is not a restarted edit. restart_edit = 0; + // Reset Changedtick_i, so that TextChangedI will only be triggered for stuff + // from insert mode, for 'o/O' this has already been done in n_opencmd + if (cap->cmdchar != 'O' && cap->cmdchar != 'o') + curbuf->b_last_changedtick_i = CHANGEDTICK(curbuf); if (edit(cmd, startln, cap->count1)) cap->retval |= CA_COMMAND_BUSY; diff --git a/src/ops.c b/src/ops.c index aa6f4af37a..c0a2981d68 100644 --- a/src/ops.c +++ b/src/ops.c @@ -4134,6 +4134,9 @@ do_pending_operator(cmdarg_T *cap, int old_col, int gui_yank) // before. restore_lbr(lbr_saved); #endif + // trigger TextChangedI + curbuf->b_last_changedtick_i = CHANGEDTICK(curbuf); + if (op_change(oap)) // will call edit() cap->retval |= CA_COMMAND_BUSY; if (restart_edit == 0) @@ -4244,6 +4247,9 @@ do_pending_operator(cmdarg_T *cap, int old_col, int gui_yank) // before. restore_lbr(lbr_saved); #endif + // trigger TextChangedI + curbuf->b_last_changedtick_i = CHANGEDTICK(curbuf); + op_insert(oap, cap->count1); #ifdef FEAT_LINEBREAK // Reset linebreak, so that formatting works correctly. diff --git a/src/option.c b/src/option.c index 58a6ed22ba..0e0b566ea2 100644 --- a/src/option.c +++ b/src/option.c @@ -3705,7 +3705,6 @@ did_set_modifiable(optset_T *args UNUSED) && curbuf->b_term != NULL && !term_is_finished(curbuf)))) { curbuf->b_p_ma = FALSE; - args->os_doskip = TRUE; return e_cannot_make_terminal_with_running_job_modifiable; } # endif @@ -3967,7 +3966,6 @@ did_set_previewwindow(optset_T *args) if (win->w_p_pvw && win != curwin) { curwin->w_p_pvw = FALSE; - args->os_doskip = TRUE; return e_preview_window_already_exists; } @@ -4106,11 +4104,9 @@ did_set_showtabline(optset_T *args UNUSED) char * did_set_smoothscroll(optset_T *args UNUSED) { - if (curwin->w_p_sms) - return NULL; + if (!curwin->w_p_sms) + curwin->w_skipcol = 0; - curwin->w_skipcol = 0; - changed_line_abv_curs(); return NULL; } @@ -4157,7 +4153,6 @@ did_set_termguicolors(optset_T *args UNUSED) !has_vtp_working()) { p_tgc = 0; - args->os_doskip = TRUE; return e_24_bit_colors_are_not_supported_on_this_environment; } if (is_term_win32()) @@ -4560,9 +4555,12 @@ did_set_winwidth(optset_T *args UNUSED) char * did_set_wrap(optset_T *args UNUSED) { - // If 'wrap' is set, set w_leftcol to zero. + // Set w_leftcol or w_skipcol to zero. if (curwin->w_p_wrap) curwin->w_leftcol = 0; + else + curwin->w_skipcol = 0; + return NULL; } @@ -4755,7 +4753,7 @@ set_bool_option( args.os_newval.boolean = value; args.os_errbuf = NULL; errmsg = options[opt_idx].opt_did_set_cb(&args); - if (args.os_doskip) + if (errmsg != NULL) return errmsg; } diff --git a/src/optiondefs.h b/src/optiondefs.h index 3dd0a70bc7..68c6f6a9a5 100644 --- a/src/optiondefs.h +++ b/src/optiondefs.h @@ -998,7 +998,7 @@ static struct vimoption options[] = (char_u *)FALSE, #endif (char_u *)0L} SCTX_INIT}, - {"filetype", "ft", P_STRING|P_EXPAND|P_ALLOCED|P_VI_DEF|P_NOGLOB|P_NFNAME, + {"filetype", "ft", P_STRING|P_ALLOCED|P_VI_DEF|P_NOGLOB|P_NFNAME, (char_u *)&p_ft, PV_FT, did_set_filetype_or_syntax, NULL, {(char_u *)"", (char_u *)0L} diff --git a/src/os_win32.h b/src/os_win32.h index 87555b7896..5995e70af2 100644 --- a/src/os_win32.h +++ b/src/os_win32.h @@ -85,6 +85,10 @@ # define COBJMACROS // For OLE: Enable "friendlier" access to objects #endif #ifndef PROTO +// Must include winsock2.h before windows.h since it conflicts with winsock.h +// (included in windows.h). +# include +# include # include // Weird: rpcndr.h defines "small" to "char", which causes trouble diff --git a/src/po/ru.cp1251.po b/src/po/ru.cp1251.po index 0c9c9ac0cf..935dacd5f7 100644 --- a/src/po/ru.cp1251.po +++ b/src/po/ru.cp1251.po @@ -21,10 +21,10 @@ # msgid "" msgstr "" -"Project-Id-Version: RuVim_0.9001968.011023\n" +"Project-Id-Version: RuVim_0.9002091.051123\n" "Report-Msgid-Bugs-To: The Vim Project, \n" -"POT-Creation-Date: 2023-10-01 11:51+0300\n" -"PO-Revision-Date: 2023-10-01 11:57+0300\n" +"POT-Creation-Date: 2023-11-05 18:50+0300\n" +"PO-Revision-Date: 2023-11-05 19:57+0300\n" "Last-Translator: Restorer, \n" "Language-Team: RuVim, https://github.com/RestorerZ/RuVim\n" "Language: ru_RU\n" @@ -439,7 +439,7 @@ msgstr "[ #, c-format msgid "xchacha20v2: using custom opslimit \"%llu\" for Key derivation." msgstr "" -"xChaCha20v2: opslimit " +"XChaCha20v2: opslimit " "\"%llu\"" # #Restorer: 'verbose'>0 @@ -447,7 +447,7 @@ msgstr "" #, c-format msgid "xchacha20v2: using default opslimit \"%llu\" for Key derivation." msgstr "" -"xChaCha20v2: opslimit " +"XChaCha20v2: opslimit " "\"%llu\"" # #Restorer: 'verbose'>0 @@ -455,7 +455,7 @@ msgstr "" #, c-format msgid "xchacha20v2: using custom memlimit \"%lu\" for Key derivation." msgstr "" -"xChaCha20v2: memlimit " +"XChaCha20v2: memlimit " "\"%lu\"" # #Restorer: 'verbose'>0 @@ -463,7 +463,7 @@ msgstr "" #, c-format msgid "xchacha20v2: using default memlimit \"%lu\" for Key derivation." msgstr "" -"xChaCha20v2: memlimit " +"XChaCha20v2: memlimit " "\"%lu\"" # #Restorer: 'verbose'>0 @@ -471,13 +471,13 @@ msgstr "" #, c-format msgid "xchacha20v2: using custom algorithm \"%d\" for Key derivation." msgstr "" -"xChaCha20v2: \"%d\"" +"XChaCha20v2: \"%d\"" # #Restorer: 'verbose'>0 # :!~ Restorer #, c-format msgid "xchacha20v2: using default algorithm \"%d\" for Key derivation." -msgstr "xChaCha20v2: \"%d\"" +msgstr "XChaCha20v2: \"%d\"" # :!~ Restorer msgid "Entering Debug mode. Type \"cont\" to continue." @@ -911,8 +911,7 @@ msgstr "" # :!~ Restorer msgid "Entering Ex mode. Type \"visual\" to go to Normal mode." msgstr "" -" Ex-. , \"visual" -"\"" +" Ex-. , :visual" # #Restorer: 'verbose'>=9 # ~!: earlier @@ -2212,7 +2211,7 @@ msgstr "" # :!~ Restorer msgid "'-nb' cannot be used: not enabled at compile time\n" msgstr "" -" '-nb'. \n" +" -nb. \n" # :!~ Restorer msgid "This Vim was not compiled with the diff feature." @@ -2351,7 +2350,7 @@ msgstr "-unregister\t\t # ~!: earlier msgid "-g\t\t\tRun using GUI (like \"gvim\")" -msgstr "-g\t\t\t ( \"gVim\")" +msgstr "-g\t\t\t ( \"gvim\")" # :!~ Restorer msgid "-f or --nofork\tForeground: Don't fork when starting GUI" @@ -2452,7 +2451,7 @@ msgstr "-f\t\t\t # :!~ Restorer msgid "-dev \t\tUse for I/O" msgstr "" -"-dev <>\t - <>" +"-dev <>\t - <>" # :!~ Restorer msgid "-A\t\t\tStart in Arabic mode" @@ -2562,7 +2561,7 @@ msgstr "" # :!~ Restorer msgid "--remote-silent Same, don't complain if there is no server" msgstr "" -"--remote-silent <> , " +"--remote-silent <> , " # #Restorer: , # ~!: earlier @@ -2575,9 +2574,8 @@ msgstr "" msgid "" "--remote-wait-silent Same, don't complain if there is no server" msgstr "" -"--remote-wait-silent <> , " +"--remote-wait-silent <> , " -# #Restorer: , # :!~ Restorer msgid "" "--remote-tab[-wait][-silent] As --remote but use tab page per file" @@ -2643,7 +2641,7 @@ msgstr "" # :!~ Restorer msgid "-display \tRun Vim on " msgstr "" -"-display \t X-" +"-display \t X-" # :!~ Restorer msgid "-iconic\t\tStart Vim iconified" @@ -2660,7 +2658,8 @@ msgstr "-foreground < # #Restorer: \t, # :!~ Restorer msgid "-font \t\tUse for normal text (also: -fn)" -msgstr "-font <>\t <> ( -fn)" +msgstr "" +"-font <>\t <> ( -fn)" # :!~ Restorer msgid "-boldfont \tUse for bold text" @@ -2932,7 +2931,7 @@ msgstr "" # :!~ Restorer msgid "??? from here until ???END lines may have been inserted/deleted" msgstr "" -", , ??? ???" +", , ??? ???" "END" # :!~ Restorer @@ -3161,9 +3160,8 @@ msgid "" " file when making changes. Quit, or continue with caution.\n" msgstr "" "\n" -"(1) , " -"\n" -" .\n" +"(1) , \n" +" .\n" "\n" " " ",\n" @@ -5387,7 +5385,8 @@ msgstr "" # :!~ Restorer msgid " for Vim defaults " msgstr "" -" Vim" +" " +"Vim " # :!~ Restorer msgid "Sponsor Vim development!" @@ -5402,16 +5401,14 @@ msgstr " # :!~ Restorer msgid "type :help sponsor for information " msgstr "" -" :help sponsor " -" " +" :help sponsor " # #Restorer: , # #Restorer: # :!~ Restorer msgid "type :help register for information " msgstr "" -" :help register " -" " +" :help register " # #Restorer: , # #Restorer: @@ -5799,7 +5796,7 @@ msgstr "E35: # :!~ Restorer msgid "E36: Not enough room" -msgstr "E36: " +msgstr "E36: " # :!~ Restorer msgid "E37: No write since last change" @@ -6237,7 +6234,8 @@ msgstr "" # :!~ Restorer msgid "E135: *Filter* Autocommands must not change current buffer" msgstr "" -"E135: *Filter* " +"E135: *Filter* " +"" # :!~ Restorer msgid "E136: viminfo: Too many errors, skipping rest of file" @@ -6549,12 +6547,13 @@ msgstr "E199: # :!~ Restorer msgid "E200: *ReadPre autocommands made the file unreadable" msgstr "" -"E200: *ReadPre " +"E200: *ReadPre " +"" # :!~ Restorer msgid "E201: *ReadPre autocommands must not change current buffer" msgstr "" -"E201: *ReadPre " +"E201: *ReadPre " "" # :!~ Restorer @@ -7226,7 +7225,7 @@ msgstr "E359: msgid "E360: Cannot execute shell with -f option" msgstr "" "E360: . " -"'-f'" +"-f" # :!~ Restorer msgid "E362: Using a boolean value as a Float" @@ -8770,8 +8769,9 @@ msgstr "" "" # :!~ Restorer -msgid "E689: Can only index a List, Dictionary or Blob" -msgstr "E689: List, Dictionary BLOB" +#, c-format +msgid "E689: Index not allowed after a %s: %s" +msgstr "E689: %s %s" # :!~ Restorer msgid "E690: Missing \"in\" after :for" @@ -10694,7 +10694,7 @@ msgstr "E1088: # :!~ Restorer #, c-format msgid "E1089: Unknown variable: %s" -msgstr "E1089: %s" +msgstr "E1089: \"%s\"" # :!~ Restorer #, c-format @@ -10704,7 +10704,7 @@ msgstr "E1090: # :!~ Restorer #, c-format msgid "E1091: Function is not compiled: %s" -msgstr "E1091: %s" +msgstr "E1091: \"%s\"" # :!~ Restorer msgid "E1092: Cannot nest :redir" @@ -11188,7 +11188,7 @@ msgstr[2] "E1190: # :!~ Restorer #, c-format msgid "E1191: Call to function that failed to compile: %s" -msgstr "E1191: %s" +msgstr "E1191: \"%s\"" # :!~ Restorer msgid "E1192: Empty function name" @@ -11197,8 +11197,7 @@ msgstr "E1192: # :!~ Restorer msgid "E1193: cryptmethod xchacha20 not built into this Vim" msgstr "" -"E1193: XChaCha20 " -"Vim" +"E1193: XChaCha20 Vim" # :!~ Restorer msgid "E1194: Cannot encrypt header, not enough space" @@ -11239,8 +11238,8 @@ msgstr "E1202: # :!~ Restorer #, c-format -msgid "E1203: Dot can only be used on a dictionary: %s" -msgstr "E1203: Dictionary %s" +msgid "E1203: Dot not allowed after a %s: %s" +msgstr "E1203: %s %s" # :!~ Restorer #, c-format @@ -11817,38 +11816,38 @@ msgid "E1318: Not a valid command in a class: %s" msgstr "E1318: %s" # :!~ Restorer -msgid "E1319: Using a class as a Number" +msgid "E1319: Using a Class as a Number" msgstr "E1319: Number, Class" # :!~ Restorer -msgid "E1320: Using an object as a Number" +msgid "E1320: Using an Object as a Number" msgstr "E1320: Number, Object" # :!~ Restorer -msgid "E1321: Using a class as a Float" +msgid "E1321: Using a Class as a Float" msgstr "E1321: Float, Class" # :!~ Restorer -msgid "E1322: Using an object as a Float" +msgid "E1322: Using an Object as a Float" msgstr "E1322: Float, Object" # :!~ Restorer -msgid "E1323: Using a class as a String" +msgid "E1323: Using a Class as a String" msgstr "E1323: String, Class" # :!~ Restorer -msgid "E1324: Using an object as a String" +msgid "E1324: Using an Object as a String" msgstr "E1324: String, Object" # :!~ Restorer #, c-format -msgid "E1325: Method not found on class \"%s\": %s" -msgstr "E1325: \"%s\" %s" +msgid "E1325: Method \"%s\" not found in class \"%s\"" +msgstr "E1325: \"%2$s\" \"%1$s\"" # :!~ Restorer #, c-format -msgid "E1326: Variable not found on object \"%s\": %s" -msgstr "E1326: \"%s\" %s" +msgid "E1326: Variable \"%s\" not found in object \"%s\"" +msgstr "E1326: \"%s\" \"%s\"" # :!~ Restorer #, c-format @@ -11879,8 +11878,9 @@ msgstr "" # :!~ Restorer #, c-format -msgid "E1333: Cannot access private variable: %s" -msgstr "E1333: %s" +msgid "E1333: Cannot access private variable \"%s\" in class \"%s\"" +msgstr "" +"E1333: \"%s\" \"%s\"" # :!~ Restorer #, c-format @@ -12047,10 +12047,9 @@ msgid "E1370: Cannot define a \"new\" method as static" msgstr "E1370: \"new\" " # :!~ Restorer -msgid "E1371: Abstract must be followed by \"def\" or \"static\"" +msgid "E1371: Abstract must be followed by \"def\"" msgstr "" -"E1371: \"abstract\" \"def\" " -" \"static\"" +"E1371: \"abstract\" \"def\"" # :!~ Restorer #, c-format @@ -12164,6 +12163,66 @@ msgstr "" "E1392: \"%s\" " " \"%s\"" +# :!~ Restorer +msgid "E1393: Type can only be defined in Vim9 script" +msgstr "" +"E1393: Vim9" + +# :!~ Restorer +#, c-format +msgid "E1394: Type name must start with an uppercase letter: %s" +msgstr "" +"E1394: %s" + +# :!~ Restorer +#, c-format +msgid "E1395: Type alias \"%s\" cannot be modified" +msgstr "E1395: \"%s\"" + +# :!~ Restorer +#, c-format +msgid "E1396: Type alias \"%s\" already exists" +msgstr "E1396: \"%s\"" + +# :!~ Restorer +msgid "E1397: Missing type alias name" +msgstr "E1397: " + +# :!~ Restorer +msgid "E1398: Missing type alias type" +msgstr "E1398: " + +# :!~ Restorer +msgid "E1399: Type can only be used in a script" +msgstr "" +"E1399: " + +# :!~ Restorer +#, c-format +msgid "E1400: Using type alias \"%s\" as a Number" +msgstr "E1400: Number, \"%s\"" + +# :!~ Restorer +#, c-format +msgid "E1401: Using type alias \"%s\" as a Float" +msgstr "E1401: Float, \"%s\"" + +# :!~ Restorer +#, c-format +msgid "E1402: Using type alias \"%s\" as a String" +msgstr "E1402: String, \"%s\"" + +# :!~ Restorer +#, c-format +msgid "E1403: Type alias \"%s\" cannot be used as a value" +msgstr "" +"E1403: \"%s\"" + +# :!~ Restorer +msgid "E1404: Abstract cannot be used in an interface" +msgstr "" +"E1404: \"abstract\" " + # :!~ Restorer #, c-format msgid "E1500: Cannot mix positional and non-positional arguments: %s" @@ -12206,10 +12265,6 @@ msgid "E1506: Buffer too small to copy xattr value or key" msgstr "" "E1506: " -# :!~ Restorer -msgid "E1507: Extended attributes are not supported by the filesystem" -msgstr "E1507: " - # :!~ Restorer msgid "" "E1508: Size of the extended attribute value is larger than the maximum size " @@ -12218,10 +12273,15 @@ msgstr "" "E1508: " # :!~ Restorer -msgid "E1509: Error occured when reading or writing extended attribute" +msgid "E1509: Error occurred when reading or writing extended attribute" msgstr "" "E1509: " +# :!~ Restorer +#, c-format +msgid "E1510: Value too large: %s" +msgstr "E1510: %s" + # #Restorer: , , `CTRL+g`, `g CTRL+g` . . # :!~ Restorer msgid "--No lines in buffer--" @@ -12673,7 +12733,7 @@ msgstr "" # #Restorer: desktop # ~!: earlier msgid "GVim" -msgstr "GVim" +msgstr "gVim" # #Restorer: desktop # ~!: earlier diff --git a/src/po/ru.po b/src/po/ru.po index e20b9a3759..01dac4791e 100644 --- a/src/po/ru.po +++ b/src/po/ru.po @@ -21,10 +21,10 @@ # msgid "" msgstr "" -"Project-Id-Version: RuVim_0.9001968.011023\n" +"Project-Id-Version: RuVim_0.9002091.051123\n" "Report-Msgid-Bugs-To: The Vim Project, \n" -"POT-Creation-Date: 2023-10-01 11:51+0300\n" -"PO-Revision-Date: 2023-10-01 11:57+0300\n" +"POT-Creation-Date: 2023-11-05 18:50+0300\n" +"PO-Revision-Date: 2023-11-05 19:57+0300\n" "Last-Translator: Restorer, \n" "Language-Team: RuVim, https://github.com/RestorerZ/RuVim\n" "Language: ru_RU\n" @@ -439,7 +439,7 @@ msgstr "[шифровано]" #, c-format msgid "xchacha20v2: using custom opslimit \"%llu\" for Key derivation." msgstr "" -"xChaCha20v2: для получения ключа применено нестандартное значение opslimit " +"XChaCha20v2: для получения ключа применено нестандартное значение opslimit " "\"%llu\"" # #Restorer: выводится при значении 'verbose'>0 @@ -447,7 +447,7 @@ msgstr "" #, c-format msgid "xchacha20v2: using default opslimit \"%llu\" for Key derivation." msgstr "" -"xChaCha20v2: для получения ключа применено стандартное значение opslimit \"%llu" +"XChaCha20v2: для получения ключа применено стандартное значение opslimit \"%llu" "\"" # #Restorer: выводится при значении 'verbose'>0 @@ -455,7 +455,7 @@ msgstr "" #, c-format msgid "xchacha20v2: using custom memlimit \"%lu\" for Key derivation." msgstr "" -"xChaCha20v2: для получения ключа применено нестандартное значение memlimit " +"XChaCha20v2: для получения ключа применено нестандартное значение memlimit " "\"%lu\"" # #Restorer: выводится при значении 'verbose'>0 @@ -463,20 +463,20 @@ msgstr "" #, c-format msgid "xchacha20v2: using default memlimit \"%lu\" for Key derivation." msgstr "" -"xChaCha20v2: для получения ключа применено стандартное значение memlimit \"%lu" +"XChaCha20v2: для получения ключа применено стандартное значение memlimit \"%lu" "\"" # #Restorer: выводится при значении 'verbose'>0 # :!~ Restorer #, c-format msgid "xchacha20v2: using custom algorithm \"%d\" for Key derivation." -msgstr "xChaCha20v2: для получения ключа применён нестандартный алгоритм \"%d\"" +msgstr "XChaCha20v2: для получения ключа применён нестандартный алгоритм \"%d\"" # #Restorer: выводится при значении 'verbose'>0 # :!~ Restorer #, c-format msgid "xchacha20v2: using default algorithm \"%d\" for Key derivation." -msgstr "xChaCha20v2: для получения ключа применён стандартный алгоритм \"%d\"" +msgstr "XChaCha20v2: для получения ключа применён стандартный алгоритм \"%d\"" # :!~ Restorer msgid "Entering Debug mode. Type \"cont\" to continue." @@ -907,7 +907,7 @@ msgstr "" # :!~ Restorer msgid "Entering Ex mode. Type \"visual\" to go to Normal mode." msgstr "" -"Переключение в Ex-режим. Чтобы переключить в режим команд, наберите \"visual\"" +"Переключение в Ex-режим. Чтобы переключить в режим команд, наберите :visual" # #Restorer: выводится при значении 'verbose'>=9 # ~!: earlier @@ -2199,7 +2199,8 @@ msgstr "" # :!~ Restorer msgid "'-nb' cannot be used: not enabled at compile time\n" -msgstr "Недопустимый аргумент командной строки '-nb'. Отключено при компиляции\n" +msgstr "" +"Неподдерживаемый аргумент командной строки -nb. Отключено при компиляции\n" # :!~ Restorer msgid "This Vim was not compiled with the diff feature." @@ -2337,7 +2338,7 @@ msgstr "-unregister\t\tОтмена регистрации программы gV # ~!: earlier msgid "-g\t\t\tRun using GUI (like \"gvim\")" -msgstr "-g\t\t\tЗапуск программы с графическим интерфейсом (как \"gVim\")" +msgstr "-g\t\t\tЗапуск программы с графическим интерфейсом (как \"gvim\")" # :!~ Restorer msgid "-f or --nofork\tForeground: Don't fork when starting GUI" @@ -2437,7 +2438,8 @@ msgstr "-f\t\t\tНе использовать команду newcli для от # #Restorer: убрал один \t, чтобы выглядело единообразно # :!~ Restorer msgid "-dev \t\tUse for I/O" -msgstr "-dev <устройство>\tИспользовать для ввода-вывода указанное <устройство>" +msgstr "" +"-dev <устройство>\tИспользовать для операций ввода-вывода данное <устройство>" # :!~ Restorer msgid "-A\t\t\tStart in Arabic mode" @@ -2544,7 +2546,7 @@ msgstr "--remote <файлы>\tРедактирование <файлов> на # :!~ Restorer msgid "--remote-silent Same, don't complain if there is no server" -msgstr "--remote-silent <файлы> То же, но без сообщений при отсутствии сервера" +msgstr "--remote-silent <файлы> То же, но не сообщать о недоступности сервера" # #Restorer: добавил пару пробельных символов, дабы подравнять сообщение # ~!: earlier @@ -2555,9 +2557,8 @@ msgstr "" # :!~ Restorer msgid "--remote-wait-silent Same, don't complain if there is no server" msgstr "" -"--remote-wait-silent <файлы> То же, но без сообщений при отсутствии сервера" +"--remote-wait-silent <файлы> То же, но не сообщать о недоступности сервера" -# #Restorer: добавил пару пробельных символов, дабы подравнять сообщение # :!~ Restorer msgid "" "--remote-tab[-wait][-silent] As --remote but use tab page per file" @@ -2621,7 +2622,7 @@ msgstr "" # :!~ Restorer msgid "-display \tRun Vim on " msgstr "" -"-display \tЗапуск программы с подключением к указанному X-серверу" +"-display \tЗапуск программы с подключением к указанному X-серверу" # :!~ Restorer msgid "-iconic\t\tStart Vim iconified" @@ -2638,7 +2639,7 @@ msgstr "-foreground <цвет>\tНазначить указанный <цвет> # #Restorer: убрал один \t, чтобы выглядело единообразно # :!~ Restorer msgid "-font \t\tUse for normal text (also: -fn)" -msgstr "-font <шрифт>\tНазначить указанный <шрифт> для обычного текста ( -fn)" +msgstr "-font <шрифт>\tНазначить указанный <шрифт> для обычного текста (или -fn)" # :!~ Restorer msgid "-boldfont \tUse for bold text" @@ -2906,7 +2907,7 @@ msgstr "Строки, которые возможно испорчены, пом # :!~ Restorer msgid "??? from here until ???END lines may have been inserted/deleted" msgstr "" -"Строки, которые были добавлены или удалены, помещены между метками ??? и ???END" +"Строки, которые были вставлены или удалены, помещены между метками ??? и ???END" # :!~ Restorer msgid "??? lines may be missing" @@ -3133,8 +3134,8 @@ msgid "" " file when making changes. Quit, or continue with caution.\n" msgstr "" "\n" -"(1) Возможно, редактирование этого же файла выполняется в другой программе на\n" -" этом же компьютере или по сетевому подключению.\n" +"(1) Возможно, редактирование этого же файла выполняется в другой программе\n" +" на этом же компьютере или по сетевому подключению.\n" "\n" "В этом случае лучше не редактировать этот файл или делать это осмотрительно,\n" "чтобы не появилось два варианта одного и того же файла.\n" @@ -5331,7 +5332,7 @@ msgstr "" # :!~ Restorer msgid " for Vim defaults " msgstr "" -" возможности редактора Vim" +" возможности редактора Vim " # :!~ Restorer msgid "Sponsor Vim development!" @@ -5346,14 +5347,14 @@ msgstr "Станьте зарегистрированным пользовате # :!~ Restorer msgid "type :help sponsor for information " msgstr "" -"наберите :help sponsor чтобы узнать об этом подробнее " +"наберите :help sponsor чтобы узнать об этом подробнее " # #Restorer: пробелы не убирать, сделано для выравнивания сообщений # #Restorer: выравнивается по самому длинному подобному сообщению # :!~ Restorer msgid "type :help register for information " msgstr "" -"наберите :help register чтобы узнать об этом подробнее " +"наберите :help register чтобы узнать об этом подробнее " # #Restorer: пробелы не убирать, сделано для выравнивания сообщений # #Restorer: выравнивается по самому длинному подобному сообщению @@ -5740,7 +5741,7 @@ msgstr "E35: В этом сеансе работы не применялся п # :!~ Restorer msgid "E36: Not enough room" -msgstr "E36: Не достаточно места для создания нового окна" +msgstr "E36: Недостаточно места для создания нового окна" # :!~ Restorer msgid "E37: No write since last change" @@ -6174,7 +6175,8 @@ msgstr "" # :!~ Restorer msgid "E135: *Filter* Autocommands must not change current buffer" -msgstr "E135: Автокоманды по событиям *Filter* не должны изменять текущий буфер" +msgstr "" +"E135: Действия автокоманд по событиям *Filter* не должны изменять текущий буфер" # :!~ Restorer msgid "E136: viminfo: Too many errors, skipping rest of file" @@ -6483,12 +6485,12 @@ msgstr "E199: Удалены активное окно или буфер" # :!~ Restorer msgid "E200: *ReadPre autocommands made the file unreadable" msgstr "" -"E200: В результате действий автокоманд по событию *ReadPre файл стал нечитаем" +"E200: В результате действий автокоманд по событиям *ReadPre файл стал нечитаем" # :!~ Restorer msgid "E201: *ReadPre autocommands must not change current buffer" msgstr "" -"E201: Действия автокоманд для событий *ReadPre не должны изменять текущий буфер" +"E201: Действия автокоманд по событиям *ReadPre не должны изменять текущий буфер" # :!~ Restorer msgid "E202: Conversion made file unreadable!" @@ -7145,8 +7147,7 @@ msgstr "E359: Установка режима экрана не поддержи # :!~ Restorer msgid "E360: Cannot execute shell with -f option" msgstr "" -"E360: Не удалось вызвать командную оболочку. Программа запущена с аргументом '-" -"f'" +"E360: Не удалось вызвать командную оболочку. Программа запущена с аргументом -f" # :!~ Restorer msgid "E362: Using a boolean value as a Float" @@ -8675,8 +8676,9 @@ msgstr "" "E688: Количество переменных больше количества присваиваемых значений выражения" # :!~ Restorer -msgid "E689: Can only index a List, Dictionary or Blob" -msgstr "E689: Индекс разрешён только для типа данных List, Dictionary или BLOB" +#, c-format +msgid "E689: Index not allowed after a %s: %s" +msgstr "E689: Не допускается указание индекса для типа данных %s в %s" # :!~ Restorer msgid "E690: Missing \"in\" after :for" @@ -10563,7 +10565,7 @@ msgstr "E1088: Не допускается импортирование кома # :!~ Restorer #, c-format msgid "E1089: Unknown variable: %s" -msgstr "E1089: Не распознана переменная %s" +msgstr "E1089: Не распознана переменная \"%s\"" # :!~ Restorer #, c-format @@ -10573,7 +10575,7 @@ msgstr "E1090: Не допускается присвоение значения # :!~ Restorer #, c-format msgid "E1091: Function is not compiled: %s" -msgstr "E1091: Некомпилированная функция %s" +msgstr "E1091: Некомпилированная функция \"%s\"" # :!~ Restorer msgid "E1092: Cannot nest :redir" @@ -11051,7 +11053,7 @@ msgstr[2] "E1190: В функцию передано на %d аргументо # :!~ Restorer #, c-format msgid "E1191: Call to function that failed to compile: %s" -msgstr "E1191: Ошибка компиляции при обращении к функции %s" +msgstr "E1191: Обращение к некомпилированной функции \"%s\"" # :!~ Restorer msgid "E1192: Empty function name" @@ -11060,7 +11062,7 @@ msgstr "E1192: Отсутствует наименование функции" # :!~ Restorer msgid "E1193: cryptmethod xchacha20 not built into this Vim" msgstr "" -"E1193: Алгоритм шифрования «XChaCha20» не поддерживается в данной программе Vim" +"E1193: Алгоритм шифрования «XChaCha20» не поддерживается в данной версии Vim" # :!~ Restorer msgid "E1194: Cannot encrypt header, not enough space" @@ -11101,8 +11103,8 @@ msgstr "E1202: Запрещён пробельный символ после '%s # :!~ Restorer #, c-format -msgid "E1203: Dot can only be used on a dictionary: %s" -msgstr "E1203: Символ точка используется только в типе данных Dictionary %s" +msgid "E1203: Dot not allowed after a %s: %s" +msgstr "E1203: Не допускается символ точки для типа данных %s в %s" # :!~ Restorer #, c-format @@ -11662,38 +11664,38 @@ msgid "E1318: Not a valid command in a class: %s" msgstr "E1318: Недопустимая команда в объявлении класса %s" # :!~ Restorer -msgid "E1319: Using a class as a Number" +msgid "E1319: Using a Class as a Number" msgstr "E1319: Ожидался тип данных Number, а получен Class" # :!~ Restorer -msgid "E1320: Using an object as a Number" +msgid "E1320: Using an Object as a Number" msgstr "E1320: Ожидался тип данных Number, а получен Object" # :!~ Restorer -msgid "E1321: Using a class as a Float" +msgid "E1321: Using a Class as a Float" msgstr "E1321: Ожидался тип данных Float, а получен Class" # :!~ Restorer -msgid "E1322: Using an object as a Float" +msgid "E1322: Using an Object as a Float" msgstr "E1322: Ожидался тип данных Float, а получен Object" # :!~ Restorer -msgid "E1323: Using a class as a String" +msgid "E1323: Using a Class as a String" msgstr "E1323: Ожидался тип данных String, а получен Class" # :!~ Restorer -msgid "E1324: Using an object as a String" +msgid "E1324: Using an Object as a String" msgstr "E1324: Ожидался тип данных String, а получен Object" # :!~ Restorer #, c-format -msgid "E1325: Method not found on class \"%s\": %s" -msgstr "E1325: У класса \"%s\" отсутствует метод %s" +msgid "E1325: Method \"%s\" not found in class \"%s\"" +msgstr "E1325: У класса \"%2$s\" отсутствует метод \"%1$s\"" # :!~ Restorer #, c-format -msgid "E1326: Variable not found on object \"%s\": %s" -msgstr "E1326: У объекта \"%s\" отсутствует переменная %s" +msgid "E1326: Variable \"%s\" not found in object \"%s\"" +msgstr "E1326: У объекта \"%s\" отсутствует переменная \"%s\"" # :!~ Restorer #, c-format @@ -11724,8 +11726,8 @@ msgstr "" # :!~ Restorer #, c-format -msgid "E1333: Cannot access private variable: %s" -msgstr "E1333: Отсутствует доступ к внутренней переменной %s" +msgid "E1333: Cannot access private variable \"%s\" in class \"%s\"" +msgstr "E1333: Отсутствует доступ к внутренней переменной \"%s\" в классе \"%s\"" # :!~ Restorer #, c-format @@ -11891,10 +11893,9 @@ msgid "E1370: Cannot define a \"new\" method as static" msgstr "E1370: Не допускается определение метода \"new\" как статического" # :!~ Restorer -msgid "E1371: Abstract must be followed by \"def\" or \"static\"" +msgid "E1371: Abstract must be followed by \"def\"" msgstr "" -"E1371: После ключевого слова \"abstract\" требуется ключевое слово \"def\" или " -"\"static\"" +"E1371: После ключевого слова \"abstract\" требуется ключевое слово \"def\"" # :!~ Restorer #, c-format @@ -12005,6 +12006,64 @@ msgstr "" "E1392: Не удалось изменить состояние блокировки переменной класса \"%s\" в " "классе \"%s\"" +# :!~ Restorer +msgid "E1393: Type can only be defined in Vim9 script" +msgstr "E1393: Псевдоним типа может быть определён только в командном файле Vim9" + +# :!~ Restorer +#, c-format +msgid "E1394: Type name must start with an uppercase letter: %s" +msgstr "" +"E1394: Наименование псевдонима типа должно начинаться с прописной буквы %s" + +# :!~ Restorer +#, c-format +msgid "E1395: Type alias \"%s\" cannot be modified" +msgstr "E1395: Не допускается изменение псевдонима типа \"%s\"" + +# :!~ Restorer +#, c-format +msgid "E1396: Type alias \"%s\" already exists" +msgstr "E1396: Псеводним типа уже определён \"%s\"" + +# :!~ Restorer +msgid "E1397: Missing type alias name" +msgstr "E1397: Не указано наименование для псевдонима типа" + +# :!~ Restorer +msgid "E1398: Missing type alias type" +msgstr "E1398: Не указан тип для псевдонима типа" + +# :!~ Restorer +msgid "E1399: Type can only be used in a script" +msgstr "" +"E1399: Псевдоним типа можжет быть определён только на уровне командного файла" + +# :!~ Restorer +#, c-format +msgid "E1400: Using type alias \"%s\" as a Number" +msgstr "E1400: Ожидался тип данных Number, а получен псевдоним типа \"%s\"" + +# :!~ Restorer +#, c-format +msgid "E1401: Using type alias \"%s\" as a Float" +msgstr "E1401: Ожидался тип данных Float, а получен псевдоним типа \"%s\"" + +# :!~ Restorer +#, c-format +msgid "E1402: Using type alias \"%s\" as a String" +msgstr "E1402: Ожидался тип данных String, а получен псевдоним типа \"%s\"" + +# :!~ Restorer +#, c-format +msgid "E1403: Type alias \"%s\" cannot be used as a value" +msgstr "E1403: Недопускается в качестве значения указывать псевдоним типа \"%s\"" + +# :!~ Restorer +msgid "E1404: Abstract cannot be used in an interface" +msgstr "" +"E1404: Недопускается использование ключевого слова \"abstract\" в интерфейсах" + # :!~ Restorer #, c-format msgid "E1500: Cannot mix positional and non-positional arguments: %s" @@ -12043,12 +12102,7 @@ msgstr "E1505: Недопустимые спецификаторы формат # :!~ Restorer msgid "E1506: Buffer too small to copy xattr value or key" -msgstr "" -"E1506: Недостаточный размер буфера для копирования расширенного атрибута" - -# :!~ Restorer -msgid "E1507: Extended attributes are not supported by the filesystem" -msgstr "E1507: В файловой системе не поддерживаются расширенные атрибуты" +msgstr "E1506: Недостаточный размер буфера для копирования расширенного атрибута" # :!~ Restorer msgid "" @@ -12058,9 +12112,14 @@ msgstr "" "E1508: Значение расширенного атрибута превышает максимально допустимый размер" # :!~ Restorer -msgid "E1509: Error occured when reading or writing extended attribute" +msgid "E1509: Error occurred when reading or writing extended attribute" msgstr "E1509: Произошла ошибка при считывании или записи расширенного атрибута" +# :!~ Restorer +#, c-format +msgid "E1510: Value too large: %s" +msgstr "E1510: Превышена допустимая величина в значении %s" + # #Restorer: выводится, например, по команде `CTRL+g`, `g CTRL+g` и т. п. # :!~ Restorer msgid "--No lines in buffer--" @@ -12508,7 +12567,7 @@ msgstr "" # #Restorer: используется для файла desktop # ~!: earlier msgid "GVim" -msgstr "GVim" +msgstr "gVim" # #Restorer: используется для файла desktop # ~!: earlier diff --git a/src/proto/ex_eval.pro b/src/proto/ex_eval.pro index a3be429b19..979d6fb8f4 100644 --- a/src/proto/ex_eval.pro +++ b/src/proto/ex_eval.pro @@ -11,6 +11,9 @@ char *get_exception_string(void *value, except_type_T type, char_u *cmdname, int int throw_exception(void *value, except_type_T type, char_u *cmdname); void discard_current_exception(void); void catch_exception(except_T *excp); +void exception_state_save(exception_state_T *estate); +void exception_state_restore(exception_state_T *estate); +void exception_state_clear(void); void report_make_pending(int pending, void *value); int cmd_is_name_only(char_u *arg); void ex_eval(exarg_T *eap); diff --git a/src/proto/getchar.pro b/src/proto/getchar.pro index 7e05870a97..b122a14d05 100644 --- a/src/proto/getchar.pro +++ b/src/proto/getchar.pro @@ -51,6 +51,7 @@ void f_getchar(typval_T *argvars, typval_T *rettv); void f_getcharstr(typval_T *argvars, typval_T *rettv); void f_getcharmod(typval_T *argvars, typval_T *rettv); void parse_queued_messages(void); +int key_protocol_enabled(void); void vungetc(int c); int fix_input_buffer(char_u *buf, int len); int input_available(void); diff --git a/src/proto/typval.pro b/src/proto/typval.pro index db8f94ebb0..3f577adf78 100644 --- a/src/proto/typval.pro +++ b/src/proto/typval.pro @@ -52,6 +52,7 @@ int check_for_list_or_dict_or_blob_arg(typval_T *args, int idx); int check_for_list_or_dict_or_blob_or_string_arg(typval_T *args, int idx); int check_for_opt_buffer_or_dict_arg(typval_T *args, int idx); int check_for_object_arg(typval_T *args, int idx); +int tv_class_alias(typval_T *tv); int check_for_class_or_list_arg(typval_T *args, int idx); char_u *tv_get_string(typval_T *varp); char_u *tv_get_string_strict(typval_T *varp); diff --git a/src/proto/vim9class.pro b/src/proto/vim9class.pro index 62d1b7d0f3..3000f57a38 100644 --- a/src/proto/vim9class.pro +++ b/src/proto/vim9class.pro @@ -4,6 +4,8 @@ void ex_class(exarg_T *eap); type_T *oc_member_type(class_T *cl, int is_object, char_u *name, char_u *name_end, int *member_idx); type_T *oc_member_type_by_idx(class_T *cl, int is_object, int member_idx); void ex_enum(exarg_T *eap); +void typealias_free(typealias_T *ta); +void typealias_unref(typealias_T *ta); void ex_type(exarg_T *eap); int class_object_index(char_u **arg, typval_T *rettv, evalarg_T *evalarg, int verbose); ufunc_T *find_class_func(char_u **arg); diff --git a/src/quickfix.c b/src/quickfix.c index a3d3e8fb79..207331f9b5 100644 --- a/src/quickfix.c +++ b/src/quickfix.c @@ -120,7 +120,7 @@ struct qf_info_S static qf_info_T ql_info; // global quickfix list static int_u last_qf_id = 0; // Last used quickfix list id -#define FMT_PATTERNS 13 // maximum number of % recognized +#define FMT_PATTERNS 14 // maximum number of % recognized /* * Structure used to hold the info of one part of 'errorformat' @@ -275,20 +275,21 @@ static struct fmtpattern } fmt_pat[FMT_PATTERNS] = { {'f', ".\\+"}, // only used when at end - {'n', "\\d\\+"}, // 1 - {'l', "\\d\\+"}, // 2 - {'e', "\\d\\+"}, // 3 - {'c', "\\d\\+"}, // 4 - {'k', "\\d\\+"}, // 5 - {'t', "."}, // 6 -#define FMT_PATTERN_M 7 - {'m', ".\\+"}, // 7 -#define FMT_PATTERN_R 8 - {'r', ".*"}, // 8 - {'p', "[- .]*"}, // 9 - {'v', "\\d\\+"}, // 10 - {'s', ".\\+"}, // 11 - {'o', ".\\+"} // 12 + {'b', "\\d\\+"}, // 1 + {'n', "\\d\\+"}, // 2 + {'l', "\\d\\+"}, // 3 + {'e', "\\d\\+"}, // 4 + {'c', "\\d\\+"}, // 5 + {'k', "\\d\\+"}, // 6 + {'t', "."}, // 7 +#define FMT_PATTERN_M 8 + {'m', ".\\+"}, // 8 +#define FMT_PATTERN_R 9 + {'r', ".*"}, // 9 + {'p', "[- .]*"}, // 10 + {'v', "\\d\\+"}, // 11 + {'s', ".\\+"}, // 12 + {'o', ".\\+"} // 13 }; /* @@ -942,6 +943,7 @@ qf_get_nextline(qfstate_T *state) typedef struct { char_u *namebuf; + int bnr; char_u *module; char_u *errmsg; int errmsglen; @@ -984,6 +986,22 @@ qf_parse_fmt_f(regmatch_T *rmp, int midx, qffields_T *fields, int prefix) return QF_OK; } +/* + * Parse the match for buffer number ('%b') pattern in regmatch. + * Return the matched value in "fields->bnr". + */ + static int +qf_parse_fmt_b(regmatch_T *rmp, int midx, qffields_T *fields) +{ + if (rmp->startp[midx] == NULL) + return QF_FAIL; + int bnr = (int)atol((char *)rmp->startp[midx]); + if (buflist_findnr(bnr) == NULL) + return QF_FAIL; + fields->bnr = bnr; + return QF_OK; +} + /* * Parse the match for error number ('%n') pattern in regmatch. * Return the matched value in "fields->enr". @@ -1213,6 +1231,7 @@ qf_parse_fmt_o(regmatch_T *rmp, int midx, qffields_T *fields) static int (*qf_parse_fmt[FMT_PATTERNS])(regmatch_T *, int, qffields_T *) = { NULL, // %f + qf_parse_fmt_b, qf_parse_fmt_n, qf_parse_fmt_l, qf_parse_fmt_e, @@ -1309,6 +1328,7 @@ qf_parse_get_fields( return QF_FAIL; fields->namebuf[0] = NUL; + fields->bnr = 0; fields->module[0] = NUL; fields->pattern[0] = NUL; if (!qf_multiscan) @@ -1713,7 +1733,7 @@ qf_init_process_nextline( : ((qfl->qf_currfile != NULL && fields->valid) ? qfl->qf_currfile : (char_u *)NULL), fields->module, - 0, + fields->bnr, fields->errmsg, fields->lnum, fields->end_lnum, diff --git a/src/sound.c b/src/sound.c index 6e949e85bc..abe412ca90 100644 --- a/src/sound.c +++ b/src/sound.c @@ -322,7 +322,7 @@ sound_wndproc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) vim_snprintf(buf, sizeof(buf), "close sound%06ld", p->snd_id); - mciSendString(buf, NULL, 0, 0); + mciSendStringA(buf, NULL, 0, 0); long result = wParam == MCI_NOTIFY_SUCCESSFUL ? 0 : wParam == MCI_NOTIFY_ABORTED ? 1 : 2; @@ -376,7 +376,7 @@ f_sound_playfile(typval_T *argvars, typval_T *rettv) { long newid = sound_id + 1; size_t len; - char_u *p, *esc; + char_u *p, *filename; WCHAR *wp; soundcb_T *soundcb; char buf[32]; @@ -385,17 +385,15 @@ f_sound_playfile(typval_T *argvars, typval_T *rettv) if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL) return; - esc = vim_strsave_shellescape(tv_get_string(&argvars[0]), FALSE, FALSE); + filename = tv_get_string(&argvars[0]); - len = STRLEN(esc) + 5 + 18 + 1; + len = STRLEN(filename) + 5 + 18 + 2 + 1; p = alloc(len); if (p == NULL) { - free(esc); return; } - vim_snprintf((char *)p, len, "open %s alias sound%06ld", esc, newid); - free(esc); + vim_snprintf((char *)p, len, "open \"%s\" alias sound%06ld", filename, newid); wp = enc_to_utf16((char_u *)p, NULL); free(p); @@ -408,7 +406,7 @@ f_sound_playfile(typval_T *argvars, typval_T *rettv) return; vim_snprintf(buf, sizeof(buf), "play sound%06ld notify", newid); - err = mciSendString(buf, NULL, 0, sound_window()); + err = mciSendStringA(buf, NULL, 0, sound_window()); if (err != 0) goto failure; @@ -426,7 +424,7 @@ f_sound_playfile(typval_T *argvars, typval_T *rettv) failure: vim_snprintf(buf, sizeof(buf), "close sound%06ld", newid); - mciSendString(buf, NULL, 0, NULL); + mciSendStringA(buf, NULL, 0, NULL); } void @@ -440,14 +438,14 @@ f_sound_stop(typval_T *argvars, typval_T *rettv UNUSED) id = tv_get_number(&argvars[0]); vim_snprintf(buf, sizeof(buf), "stop sound%06ld", id); - mciSendString(buf, NULL, 0, NULL); + mciSendStringA(buf, NULL, 0, NULL); } void f_sound_clear(typval_T *argvars UNUSED, typval_T *rettv UNUSED) { PlaySoundW(NULL, NULL, 0); - mciSendString("close all", NULL, 0, NULL); + mciSendStringA("close all", NULL, 0, NULL); } # if defined(EXITFREE) diff --git a/src/structs.h b/src/structs.h index 48a400cd10..8eff67fd04 100644 --- a/src/structs.h +++ b/src/structs.h @@ -1088,6 +1088,20 @@ struct cleanup_stuff except_T *exception; // exception value }; +/* + * Exception state that is saved and restored when calling timer callback + * functions and deferred functions. + */ +typedef struct exception_state_S exception_state_T; +struct exception_state_S +{ + except_T *estate_current_exception; + int estate_did_throw; + int estate_need_rethrow; + int estate_trylevel; + int estate_did_emsg; +}; + #ifdef FEAT_SYN_HL // struct passed to in_id_list() struct sp_syn @@ -1454,6 +1468,7 @@ typedef struct ectx_S ectx_T; typedef struct instr_S instr_T; typedef struct class_S class_T; typedef struct object_S object_T; +typedef struct typealias_S typealias_T; typedef enum { @@ -1475,6 +1490,7 @@ typedef enum VAR_INSTR, // "v_instr" is used VAR_CLASS, // "v_class" is used (also used for interface) VAR_OBJECT, // "v_object" is used + VAR_TYPEALIAS // "v_typealias" is used } vartype_T; // A type specification. @@ -1588,6 +1604,13 @@ struct object_S int obj_copyID; // used by garbage collection }; +struct typealias_S +{ + int ta_refcount; + type_T *ta_type; + char_u *ta_name; +}; + /* * Structure to hold an internal variable without a name. */ @@ -1611,6 +1634,7 @@ struct typval_S instr_T *v_instr; // instructions to execute class_T *v_class; // class value (can be NULL) object_T *v_object; // object value (can be NULL) + typealias_T *v_typealias; // user-defined type name } vval; }; @@ -4943,10 +4967,6 @@ typedef struct char_u *string; } os_newval; - // When set by the called function: Stop processing the option further. - // Currently only used for boolean options. - int os_doskip; - // Option value was checked to be safe, no need to set P_INSECURE // Used for the 'keymap', 'filetype' and 'syntax' options. int os_value_checked; diff --git a/src/testdir/Make_all.mak b/src/testdir/Make_all.mak index 925a731b6a..7388619763 100644 --- a/src/testdir/Make_all.mak +++ b/src/testdir/Make_all.mak @@ -44,7 +44,8 @@ TEST_VIM9 = \ test_vim9_fails \ test_vim9_func \ test_vim9_import \ - test_vim9_script + test_vim9_script \ + test_vim9_typealias TEST_VIM9_RES = \ test_vim9_assign.res \ @@ -56,7 +57,8 @@ TEST_VIM9_RES = \ test_vim9_fails.res \ test_vim9_func.res \ test_vim9_import.res \ - test_vim9_script.res + test_vim9_script.res \ + test_vim9_typealias.res # Benchmark scripts. SCRIPTS_BENCH = test_bench_regexp.res diff --git a/src/testdir/runtest.vim b/src/testdir/runtest.vim index 2545791b54..1752157b18 100644 --- a/src/testdir/runtest.vim +++ b/src/testdir/runtest.vim @@ -215,7 +215,7 @@ endfunc for name in s:GetSwapFileList() call delete(name) endfor -unlet name +unlet! name " Invoked when a test takes too much time. @@ -277,6 +277,8 @@ func RunTheTest(test) endtry endif + let skipped = v:false + au VimLeavePre * call EarlyExit(g:testfunc) if a:test =~ 'Test_nocatch_' " Function handles errors itself. This avoids skipping commands after the @@ -286,6 +288,7 @@ func RunTheTest(test) if g:skipped_reason != '' call add(s:messages, ' Skipped') call add(s:skipped, 'SKIPPED ' . a:test . ': ' . g:skipped_reason) + let skipped = v:true endif else try @@ -293,6 +296,7 @@ func RunTheTest(test) catch /^\cskipped/ call add(s:messages, ' Skipped') call add(s:skipped, 'SKIPPED ' . a:test . ': ' . substitute(v:exception, '^\S*\s\+', '', '')) + let skipped = v:true catch call add(v:errors, 'Caught exception in ' . a:test . ': ' . v:exception . ' @ ' . v:throwpoint) endtry @@ -400,14 +404,16 @@ func RunTheTest(test) endif endwhile - " Check if the test has left any swap files behind. Delete them before - " running tests again, they might interfere. - let swapfiles = s:GetSwapFileList() - if len(swapfiles) > 0 - call add(s:messages, "Found swap files: " .. string(swapfiles)) - for name in swapfiles - call delete(name) - endfor + if !skipped + " Check if the test has left any swap files behind. Delete them before + " running tests again, they might interfere. + let swapfiles = s:GetSwapFileList() + if len(swapfiles) > 0 + call add(s:messages, "Found swap files: " .. string(swapfiles)) + for name in swapfiles + call delete(name) + endfor + endif endif endfunc diff --git a/src/testdir/shared.vim b/src/testdir/shared.vim index d373a6e740..4d008a0bfc 100644 --- a/src/testdir/shared.vim +++ b/src/testdir/shared.vim @@ -113,6 +113,8 @@ func RunServer(cmd, testfunc, args) endif call call(function(a:testfunc), [port]) + catch /E901.*Address family for hostname not supported/ + throw 'Skipped: Invalid network setup ("' .. v:exception .. '" in ' .. v:throwpoint .. ')' catch call assert_report('Caught exception: "' . v:exception . '" in ' . v:throwpoint) finally diff --git a/src/testdir/test_arabic.vim b/src/testdir/test_arabic.vim index 73b85c4783..d2f28d8183 100644 --- a/src/testdir/test_arabic.vim +++ b/src/testdir/test_arabic.vim @@ -74,9 +74,9 @@ endfunc func Test_arabic_toggle_keymap() new set arabic - call feedkeys("i12\12\12", 'tx') - call assert_match("^ *٢١21٢١$", ScreenLines(1, &columns)[0]) - call assert_equal('١٢12١٢', getline('.')) + call feedkeys("i12\12\12abcd", 'tx') + call assert_match("^ *.*ﺷ212121$", ScreenLines(1, &columns)[0]) + call assert_equal('121212شلاؤي', getline('.')) set arabic& bwipe! endfunc diff --git a/src/testdir/test_autocmd.vim b/src/testdir/test_autocmd.vim index 3b0d3cdd96..b633c846f6 100644 --- a/src/testdir/test_autocmd.vim +++ b/src/testdir/test_autocmd.vim @@ -2566,28 +2566,27 @@ func Test_ChangedP() call cursor(3, 1) let g:autocmd = '' call feedkeys("o\", 'tnix') - " `TextChangedI` triggers only if text is actually changed in Insert mode - call assert_equal('', g:autocmd) + call assert_equal('I', g:autocmd) let g:autocmd = '' call feedkeys("Sf", 'tnix') - call assert_equal('I', g:autocmd) + call assert_equal('II', g:autocmd) let g:autocmd = '' call feedkeys("Sf\", 'tnix') - call assert_equal('IP', g:autocmd) + call assert_equal('IIP', g:autocmd) let g:autocmd = '' call feedkeys("Sf\\", 'tnix') - call assert_equal('IPP', g:autocmd) + call assert_equal('IIPP', g:autocmd) let g:autocmd = '' call feedkeys("Sf\\\", 'tnix') - call assert_equal('IPPP', g:autocmd) + call assert_equal('IIPPP', g:autocmd) let g:autocmd = '' call feedkeys("Sf\\\\", 'tnix') - call assert_equal('IPPPP', g:autocmd) + call assert_equal('IIPPPP', g:autocmd) call assert_equal(['foo', 'bar', 'foobar', 'foo'], getline(1, '$')) " TODO: how should it handle completeopt=noinsert,noselect? @@ -3621,6 +3620,25 @@ func Test_Changed_ChangedI() call feedkeys("ibar\", 'tnix') call assert_equal('', g:autocmd_n) + " If change is a mix of Normal and Insert modes, TextChangedI should trigger + func s:validate_mixed_textchangedi(keys) + call feedkeys("ifoo\", 'tnix') + let g:autocmd_i = '' + let g:autocmd_n = '' + call feedkeys(a:keys, 'tnix') + call assert_notequal('', g:autocmd_i) + call assert_equal('', g:autocmd_n) + endfunc + + call s:validate_mixed_textchangedi("o\") + call s:validate_mixed_textchangedi("O\") + call s:validate_mixed_textchangedi("ciw\") + call s:validate_mixed_textchangedi("cc\") + call s:validate_mixed_textchangedi("C\") + call s:validate_mixed_textchangedi("s\") + call s:validate_mixed_textchangedi("S\") + + " CleanUp call test_override("char_avail", 0) au! TextChanged diff --git a/src/testdir/test_digraph.vim b/src/testdir/test_digraph.vim index a8a55a793b..4aed403cda 100644 --- a/src/testdir/test_digraph.vim +++ b/src/testdir/test_digraph.vim @@ -37,6 +37,9 @@ func Test_digraphs() call Put_Dig("=P") call Put_Dig("P=") call assert_equal(['Р']+repeat(["₽"],2)+['П'], getline(line('.')-3,line('.'))) + " Quadruple prime + call Put_Dig("'4") + call assert_equal("⁗", getline('.')) " Not a digraph call Put_Dig("a\") call Put_Dig("\a") diff --git a/src/testdir/test_filetype.vim b/src/testdir/test_filetype.vim index dbaf9696f1..bde5c1bc43 100644 --- a/src/testdir/test_filetype.vim +++ b/src/testdir/test_filetype.vim @@ -277,6 +277,7 @@ def s:GetFilenameChecks(): dict> gkrellmrc: ['gkrellmrc', 'gkrellmrc_x'], gleam: ['file.gleam'], glsl: ['file.glsl'], + gn: ['file.gn', 'file.gni'], gnash: ['gnashrc', '.gnashrc', 'gnashpluginrc', '.gnashpluginrc'], gnuplot: ['file.gpi', '.gnuplot'], go: ['file.go'], @@ -334,6 +335,7 @@ def s:GetFilenameChecks(): dict> j: ['file.ijs'], jal: ['file.jal', 'file.JAL'], jam: ['file.jpl', 'file.jpr', 'JAM-file.file', 'JAM.file', 'Prl-file.file', 'Prl.file'], + janet: ['file.janet'], java: ['file.java', 'file.jav'], javacc: ['file.jj', 'file.jjt'], javascript: ['file.js', 'file.jsm', 'file.javascript', 'file.es', 'file.mjs', 'file.cjs'], @@ -493,6 +495,7 @@ def s:GetFilenameChecks(): dict> nsis: ['file.nsi', 'file.nsh'], nu: ['env.nu', 'config.nu'], obj: ['file.obj'], + objdump: ['file.objdump', 'file.cppobjdump'], obse: ['file.obl', 'file.obse', 'file.oblivion', 'file.obscript'], ocaml: ['file.ml', 'file.mli', 'file.mll', 'file.mly', '.ocamlinit', 'file.mlt', 'file.mlp', 'file.mlip', 'file.mli.cppo', 'file.ml.cppo'], occam: ['file.occ'], @@ -799,6 +802,7 @@ def s:GetFilenameChecks(): dict> xf86conf: ['xorg.conf', 'xorg.conf-4'], xhtml: ['file.xhtml', 'file.xht'], xinetd: ['/etc/xinetd.conf', '/etc/xinetd.d/file', 'any/etc/xinetd.conf', 'any/etc/xinetd.d/file'], + xkb: ['/usr/share/X11/xkb/compat/pc', '/usr/share/X11/xkb/geometry/pc', '/usr/share/X11/xkb/keycodes/evdev', '/usr/share/X11/xkb/symbols/pc', '/usr/share/X11/xkb/types/pc'], xmath: ['file.msc', 'file.msf'], xml: ['/etc/blkid.tab', '/etc/blkid.tab.old', 'file.xmi', 'file.csproj', 'file.csproj.user', 'file.fsproj', 'file.fsproj.user', 'file.vbproj', 'file.vbproj.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', 'file.cdxml', 'file.psc1', 'file.mpd'], xmodmap: ['anyXmodmap', 'Xmodmap', 'some-Xmodmap', 'some-xmodmap', 'some-xmodmap-file', 'xmodmap', 'xmodmap-file'], @@ -813,10 +817,9 @@ def s:GetFilenameChecks(): dict> yang: ['file.yang'], yuck: ['file.yuck'], z8a: ['file.z8a'], - zig: ['file.zig'], + zig: ['file.zig', 'build.zig.zon'], zimbu: ['file.zu'], zimbutempl: ['file.zut'], - zir: ['file.zir'], zserio: ['file.zs'], zsh: ['.zprofile', '/etc/zprofile', '.zfbfmarks', 'file.zsh', '.zcompdump', '.zlogin', '.zlogout', '.zshenv', '.zshrc', @@ -952,6 +955,8 @@ def s:GetScriptChecks(): dict>> crystal: [['#!/path/crystal']], rexx: [['#!/path/rexx'], ['#!/path/regina']], + janet: [['#!/path/janet']], + dart: [['#!/path/dart']], } enddef @@ -1477,12 +1482,12 @@ func Test_hook_file() call writefile(['[Trigger]', 'this is pacman config'], 'Xfile.hook', 'D') split Xfile.hook - call assert_equal('conf', &filetype) + call assert_equal('confini', &filetype) bwipe! call writefile(['not pacman'], 'Xfile.hook') split Xfile.hook - call assert_notequal('conf', &filetype) + call assert_notequal('confini', &filetype) bwipe! filetype off diff --git a/src/testdir/test_history.vim b/src/testdir/test_history.vim index bb6d671725..482328ab4a 100644 --- a/src/testdir/test_history.vim +++ b/src/testdir/test_history.vim @@ -254,4 +254,12 @@ func Test_history_crypt_key() set key& bs& ts& endfunc +" The following used to overflow and causing an use-after-free +func Test_history_max_val() + + set history=10 + call assert_fails(':history 2147483648', 'E1510:') + set history& +endfunc + " vim: shiftwidth=2 sts=2 expandtab diff --git a/src/testdir/test_ins_complete.vim b/src/testdir/test_ins_complete.vim index a4ac26e06c..61ddcd378b 100644 --- a/src/testdir/test_ins_complete.vim +++ b/src/testdir/test_ins_complete.vim @@ -2267,17 +2267,72 @@ func Test_complete_info_index() " Ensure 'index' in complete_info() is coherent with the 'items' array. set completeopt=menu,preview - " Search forward. + " Search forward call feedkeys("Go\\\\_dd", 'tx') call assert_equal("aaa", g:compl_info['items'][g:compl_info['selected']]['word']) + call assert_equal(6 , len(g:compl_info['items'])) call feedkeys("Go\\\\\_dd", 'tx') call assert_equal("bbb", g:compl_info['items'][g:compl_info['selected']]['word']) + call assert_equal(6 , len(g:compl_info['items'])) + call feedkeys("Go\\\\\\_dd", 'tx') + call assert_equal("ccc", g:compl_info['items'][g:compl_info['selected']]['word']) + call assert_equal(6 , len(g:compl_info['items'])) + call feedkeys("Go\\\\\\\_dd", 'tx') + call assert_equal("ddd", g:compl_info['items'][g:compl_info['selected']]['word']) + call assert_equal(6 , len(g:compl_info['items'])) + call feedkeys("Go\\\\\\\\_dd", 'tx') + call assert_equal("eee", g:compl_info['items'][g:compl_info['selected']]['word']) + call assert_equal(6 , len(g:compl_info['items'])) + call feedkeys("Go\\\\\\\\\_dd", 'tx') + call assert_equal("fff", g:compl_info['items'][g:compl_info['selected']]['word']) + call assert_equal(6 , len(g:compl_info['items'])) + " Search forward: unselected item + call feedkeys("Go\\\\\\\\\\_dd", 'tx') + call assert_equal(6 , len(g:compl_info['items'])) + call assert_equal(-1 , g:compl_info['selected']) - " Search backward. + " Search backward call feedkeys("Go\\\\_dd", 'tx') call assert_equal("fff", g:compl_info['items'][g:compl_info['selected']]['word']) + call assert_equal(6 , len(g:compl_info['items'])) call feedkeys("Go\\\\\_dd", 'tx') call assert_equal("eee", g:compl_info['items'][g:compl_info['selected']]['word']) + call assert_equal(6 , len(g:compl_info['items'])) + call feedkeys("Go\\\\\\_dd", 'tx') + call assert_equal("ddd", g:compl_info['items'][g:compl_info['selected']]['word']) + call assert_equal(6 , len(g:compl_info['items'])) + call feedkeys("Go\\\\\\\_dd", 'tx') + call assert_equal("ccc", g:compl_info['items'][g:compl_info['selected']]['word']) + call assert_equal(6 , len(g:compl_info['items'])) + call feedkeys("Go\\\\\\\\_dd", 'tx') + call assert_equal("bbb", g:compl_info['items'][g:compl_info['selected']]['word']) + call assert_equal(6 , len(g:compl_info['items'])) + call feedkeys("Go\\\\\\\\\_dd", 'tx') + call assert_equal("aaa", g:compl_info['items'][g:compl_info['selected']]['word']) + call assert_equal(6 , len(g:compl_info['items'])) + " search backwards: unselected item + call feedkeys("Go\\\\\\\\\\_dd", 'tx') + call assert_equal(6 , len(g:compl_info['items'])) + call assert_equal(-1 , g:compl_info['selected']) + + " switch direction: forwards, then backwards + call feedkeys("Go\\\\\\_dd", 'tx') + call assert_equal("fff", g:compl_info['items'][g:compl_info['selected']]['word']) + call assert_equal(6 , len(g:compl_info['items'])) + " switch direction: forwards, then backwards, then forwards again + call feedkeys("Go\\\\\\_dd", 'tx') + call feedkeys("Go\\\\\\\\_dd", 'tx') + call assert_equal("aaa", g:compl_info['items'][g:compl_info['selected']]['word']) + call assert_equal(6 , len(g:compl_info['items'])) + + " switch direction: backwards, then forwards + call feedkeys("Go\\\\\\_dd", 'tx') + call assert_equal("aaa", g:compl_info['items'][g:compl_info['selected']]['word']) + call assert_equal(6 , len(g:compl_info['items'])) + " switch direction: backwards, then forwards, then backwards again + call feedkeys("Go\\\\\\\\_dd", 'tx') + call assert_equal("fff", g:compl_info['items'][g:compl_info['selected']]['word']) + call assert_equal(6 , len(g:compl_info['items'])) " Add 'noselect', check that 'selected' is -1 when nothing is selected. set completeopt+=noselect @@ -2289,6 +2344,17 @@ func Test_complete_info_index() call feedkeys("Go\\\\_dd", 'tx') call assert_equal(-1, g:compl_info['selected']) + call feedkeys("Go\\\\\_dd", 'tx') + call assert_equal(0, g:compl_info['selected']) + call assert_equal(6 , len(g:compl_info['items'])) + call assert_equal("fff", g:compl_info['items'][g:compl_info['selected']]['word']) + call feedkeys("Go\\\\\\\\\\\\_dd", 'tx') + call assert_equal("aaa", g:compl_info['items'][g:compl_info['selected']]['word']) + call assert_equal(6 , len(g:compl_info['items'])) + call feedkeys("Go\\\\_dd", 'tx') + call assert_equal(-1, g:compl_info['selected']) + call assert_equal(6 , len(g:compl_info['items'])) + set completeopt& bwipe! endfunc diff --git a/src/testdir/test_options.vim b/src/testdir/test_options.vim index 278babe776..a71ea63759 100644 --- a/src/testdir/test_options.vim +++ b/src/testdir/test_options.vim @@ -2219,4 +2219,20 @@ func Test_set_keyprotocol() let &term = term endfunc +func Test_set_wrap() + " Unsetting 'wrap' when 'smoothscroll' is set does not result in incorrect + " cursor position. + set wrap smoothscroll scrolloff=5 + + call setline(1, ['', 'aaaa'->repeat(500)]) + 20 split + 20 vsplit + norm 2G$ + redraw + set nowrap + call assert_equal(2, winline()) + + set wrap& smoothscroll& scrolloff& +endfunc + " vim: shiftwidth=2 sts=2 expandtab diff --git a/src/testdir/test_quickfix.vim b/src/testdir/test_quickfix.vim index 33ce700f0b..c784a2da59 100644 --- a/src/testdir/test_quickfix.vim +++ b/src/testdir/test_quickfix.vim @@ -6447,4 +6447,53 @@ func Test_quickfix_buffer_contents() call setqflist([], 'f') endfunc +" Test for "%b" in "errorformat" +func Test_efm_format_b() + call setqflist([], 'f') + new + call setline(1, ['1: abc', '1: def', '1: ghi']) + let b1 = bufnr() + new + call setline(1, ['2: abc', '2: def', '2: ghi']) + let b2 = bufnr() + new + call setline(1, ['3: abc', '3: def', '3: ghi']) + let b3 = bufnr() + new + let lines =<< trim eval END + {b1}:1:1 + {b2}:2:2 + {b3}:3:3 + END + call setqflist([], ' ', #{lines: lines, efm: '%b:%l:%c'}) + cfirst + call assert_equal([b1, 1, 1], [bufnr(), line('.'), col('.')]) + cnext + call assert_equal([b2, 2, 2], [bufnr(), line('.'), col('.')]) + cnext + call assert_equal([b3, 3, 3], [bufnr(), line('.'), col('.')]) + enew! + + " Use a non-existing buffer + let lines =<< trim eval END + 9991:1:1:m1 + 9992:2:2:m2 + {b3}:3:3:m3 + END + call setqflist([], ' ', #{lines: lines, efm: '%b:%l:%c:%m'}) + cfirst | cnext + call assert_equal([b3, 3, 3], [bufnr(), line('.'), col('.')]) + " Lines with non-existing buffer numbers should be used as non-error lines + call assert_equal([ + \ #{lnum: 0, bufnr: 0, end_lnum: 0, pattern: '', valid: 0, vcol: 0, nr: -1, + \ module: '', type: '', end_col: 0, col: 0, text: '9991:1:1:m1'}, + \ #{lnum: 0, bufnr: 0, end_lnum: 0, pattern: '', valid: 0, vcol: 0, nr: -1, + \ module: '', type: '', end_col: 0, col: 0, text: '9992:2:2:m2'}, + \ #{lnum: 3, bufnr: b3, end_lnum: 0, pattern: '', valid: 1, vcol: 0, + \ nr: -1, module: '', type: '', end_col: 0, col: 3, text: 'm3'}], + \ getqflist()) + %bw! + call setqflist([], 'f') +endfunc + " vim: shiftwidth=2 sts=2 expandtab diff --git a/src/testdir/test_user_func.vim b/src/testdir/test_user_func.vim index 82b5f91c6b..57a093c9c9 100644 --- a/src/testdir/test_user_func.vim +++ b/src/testdir/test_user_func.vim @@ -870,5 +870,102 @@ func Test_defer_wrong_arguments() call v9.CheckScriptFailure(lines, 'E1013: Argument 1: type mismatch, expected string but got number') endfunc +" Test for calling a deferred function after an exception +func Test_defer_after_exception() + let g:callTrace = [] + func Bar() + let g:callTrace += [1] + throw 'InnerException' + endfunc + + func Defer() + let g:callTrace += [2] + let g:callTrace += [3] + try + call Bar() + catch /InnerException/ + let g:callTrace += [4] + endtry + let g:callTrace += [5] + let g:callTrace += [6] + endfunc + + func Foo() + defer Defer() + throw "TestException" + endfunc + + try + call Foo() + catch /TestException/ + let g:callTrace += [7] + endtry + call assert_equal([2, 3, 1, 4, 5, 6, 7], g:callTrace) + + delfunc Defer + delfunc Foo + delfunc Bar + unlet g:callTrace +endfunc + +" Test for multiple deferred function which throw exceptions. +" Exceptions thrown by deferred functions should result in error messages but +" not propagated into the calling functions. +func Test_multidefer_with_exception() + let g:callTrace = [] + func Except() + let g:callTrace += [1] + throw 'InnerException' + let g:callTrace += [2] + endfunc + + func FirstDefer() + let g:callTrace += [3] + let g:callTrace += [4] + endfunc + + func SecondDeferWithExcept() + let g:callTrace += [5] + call Except() + let g:callTrace += [6] + endfunc + + func ThirdDefer() + let g:callTrace += [7] + let g:callTrace += [8] + endfunc + + func Foo() + let g:callTrace += [9] + defer FirstDefer() + defer SecondDeferWithExcept() + defer ThirdDefer() + let g:callTrace += [10] + endfunc + + let v:errmsg = '' + try + let g:callTrace += [11] + call Foo() + let g:callTrace += [12] + catch /TestException/ + let g:callTrace += [13] + catch + let g:callTrace += [14] + finally + let g:callTrace += [15] + endtry + let g:callTrace += [16] + + call assert_equal('E605: Exception not caught: InnerException', v:errmsg) + call assert_equal([11, 9, 10, 7, 8, 5, 1, 3, 4, 12, 15, 16], g:callTrace) + + unlet g:callTrace + delfunc Except + delfunc FirstDefer + delfunc SecondDeferWithExcept + delfunc ThirdDefer + delfunc Foo +endfunc " vim: shiftwidth=2 sts=2 expandtab diff --git a/src/testdir/test_vim9_assign.vim b/src/testdir/test_vim9_assign.vim index bff9c9f8f1..3b4c78be07 100644 --- a/src/testdir/test_vim9_assign.vim +++ b/src/testdir/test_vim9_assign.vim @@ -1890,7 +1890,7 @@ def Test_assign_funcref_args() var FuncAnyVA: func(...any): number FuncAnyVA = (v): number => v END - v9.CheckScriptFailure(lines, 'E1012: Type mismatch; expected func(...any): number but got func(any): number') + v9.CheckScriptFailure(lines, 'E1180: Variable arguments type must be a list: any') # varargs must match lines =<< trim END @@ -1898,7 +1898,7 @@ def Test_assign_funcref_args() var FuncAnyVA: func(...any): number FuncAnyVA = (v1, v2): number => v1 + v2 END - v9.CheckScriptFailure(lines, 'E1012: Type mismatch; expected func(...any): number but got func(any, any): number') + v9.CheckScriptFailure(lines, 'E1180: Variable arguments type must be a list: any') # varargs must match lines =<< trim END @@ -1906,7 +1906,7 @@ def Test_assign_funcref_args() var FuncAnyVA: func(...any): number FuncAnyVA = (v1: list): number => 3 END - v9.CheckScriptFailure(lines, 'E1012: Type mismatch; expected func(...any): number but got func(list): number') + v9.CheckScriptFailure(lines, 'E1180: Variable arguments type must be a list: any') enddef def Test_assign_funcref_arg_any() @@ -2986,4 +2986,75 @@ def Test_heredoc_expr() v9.CheckDefAndScriptFailure(lines, 'E15: Invalid expression: "}"') enddef +" Test for assigning to a multi-dimensional list item. +def Test_list_item_assign() + var lines =<< trim END + vim9script + + def Foo() + var l: list> = [['x', 'x', 'x'], ['y', 'y', 'y']] + var z: number = 1 + + [l[1][2], z] = ['a', 20] + assert_equal([['x', 'x', 'x'], ['y', 'y', 'a']], l) + enddef + Foo() + END + v9.CheckSourceSuccess(lines) + + lines =<< trim END + vim9script + + var l: list> = [['x', 'x', 'x'], ['y', 'y', 'y']] + var z: number = 1 + + [l[1][2], z] = ['a', 20] + assert_equal([['x', 'x', 'x'], ['y', 'y', 'a']], l) + END + v9.CheckSourceSuccess(lines) +enddef + +" Test for assigning to a multi-dimensional dict item. +def Test_dict_item_assign() + # This used to fail with the error "E1105: Cannot convert list to string" + # (Github issue #13485) + var lines =<< trim END + vim9script + def F() + var d: dict> = {a: {b: 0}} + + for group in keys(d) + d['a']['b'] += 1 + endfor + assert_equal({a: {b: 1}}, d) + enddef + F() + END + v9.CheckSourceSuccess(lines) + + # This used to crash Vim + lines =<< trim END + vim9script + def F() + var d: dict> = {a: {b: 0}} + d['a']['b'] += 1 + assert_equal({a: {b: 1}}, d) + enddef + F() + END + v9.CheckSourceSuccess(lines) + + # Assignment at script level + lines =<< trim END + vim9script + var d: dict> = {a: {b: 0}} + + for group in keys(d) + d['a']['b'] += 1 + endfor + assert_equal({a: {b: 1}}, d) + END + v9.CheckSourceSuccess(lines) +enddef + " vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker diff --git a/src/testdir/test_vim9_class.vim b/src/testdir/test_vim9_class.vim index 01cf3e128f..1f639e2b3f 100644 --- a/src/testdir/test_vim9_class.vim +++ b/src/testdir/test_vim9_class.vim @@ -35,7 +35,7 @@ def Test_class_basic() END v9.CheckSourceFailure(lines, 'E475: Invalid argument: noclass Something', 2) - # Only the completed word "class" should be recognized + # Only the complete word "class" should be recognized lines =<< trim END vim9script abstract classy Something @@ -132,7 +132,7 @@ def Test_class_basic() endclass var obj = Something.new() END - v9.CheckSourceFailure(lines, 'E1326: Variable not found on object "Something": state', 1) + v9.CheckSourceFailure(lines, 'E1326: Variable "state" not found in object "Something"', 1) # Space before ":" in a member variable declaration lines =<< trim END @@ -170,7 +170,7 @@ def Test_class_basic() if A endif END - v9.CheckSourceFailure(lines, 'E1319: Using a class as a Number', 4) + v9.CheckSourceFailure(lines, 'E1319: Using a Class as a Number', 4) # Test for using object as a bool lines =<< trim END @@ -181,7 +181,7 @@ def Test_class_basic() if a endif END - v9.CheckSourceFailure(lines, 'E1320: Using an object as a Number', 5) + v9.CheckSourceFailure(lines, 'E1320: Using an Object as a Number', 5) # Test for using class as a float lines =<< trim END @@ -190,7 +190,7 @@ def Test_class_basic() endclass sort([1.1, A], 'f') END - v9.CheckSourceFailure(lines, 'E1321: Using a class as a Float', 4) + v9.CheckSourceFailure(lines, 'E1321: Using a Class as a Float', 4) # Test for using object as a float lines =<< trim END @@ -200,7 +200,7 @@ def Test_class_basic() var a = A.new() sort([1.1, a], 'f') END - v9.CheckSourceFailure(lines, 'E1322: Using an object as a Float', 5) + v9.CheckSourceFailure(lines, 'E1322: Using an Object as a Float', 5) # Test for using class as a string lines =<< trim END @@ -209,7 +209,7 @@ def Test_class_basic() endclass :exe 'call ' .. A END - v9.CheckSourceFailure(lines, 'E1323: Using a class as a String', 4) + v9.CheckSourceFailure(lines, 'E1323: Using a Class as a String', 4) # Test for using object as a string lines =<< trim END @@ -219,7 +219,7 @@ def Test_class_basic() var a = A.new() :exe 'call ' .. a END - v9.CheckSourceFailure(lines, 'E1324: Using an object as a String', 5) + v9.CheckSourceFailure(lines, 'E1324: Using an Object as a String', 5) # Test creating a class with member variables and methods, calling a object # method. Check for using type() and typename() with a class and an object. @@ -648,7 +648,7 @@ def Test_member_any_used_as_object() var outer_obj = Outer.new(inner_obj) F(outer_obj) END - v9.CheckSourceFailure(lines, 'E1326: Variable not found on object "Inner": someval', 1) + v9.CheckSourceFailure(lines, 'E1326: Variable "someval" not found in object "Inner"', 1) enddef " Nested assignment to a object variable which is of another class type @@ -1092,7 +1092,7 @@ def Test_instance_variable_access() trip.three = 33 assert_equal(33, trip.three) - assert_fails('trip.four = 4', 'E1326: Variable not found on object "Triple": four') + assert_fails('trip.four = 4', 'E1326: Variable "four" not found in object "Triple"') END v9.CheckSourceSuccess(lines) @@ -1743,7 +1743,7 @@ def Test_class_member() var a = A.new() var v = a.bar END - v9.CheckSourceFailure(lines, 'E1337: Class variable "bar" not found in class "A"', 5) + v9.CheckSourceFailure(lines, 'E1326: Variable "bar" not found in object "A"', 5) enddef " These messages should show the defining class of the variable (base class), @@ -2080,7 +2080,7 @@ def Test_class_defcompile() var a = A.new() defcompile a.Foo() END - v9.CheckSourceFailureList(lines, ['E1326: Variable not found on object "A": Foo', 'E475: Invalid argument: a.Foo()']) + v9.CheckSourceFailureList(lines, ['E1326: Variable "Foo" not found in object "A"', 'E475: Invalid argument: a.Foo()']) enddef def Test_class_object_to_string() @@ -3055,7 +3055,7 @@ def Test_abstract_class() endclass var p = Base.new('Peter') END - v9.CheckSourceFailure(lines, 'E1325: Method not found on class "Base": new', 8) + v9.CheckSourceFailure(lines, 'E1325: Method "new" not found in class "Base"', 8) lines =<< trim END abstract class Base @@ -4186,8 +4186,8 @@ enddef def Test_lockvar_islocked() # Can't lock class/object variable # Lock class/object variable's value - # Lock item of variabl's value (a list item) - # varible is at index 1 within class/object + # Lock item of variable's value (a list item) + # variable is at index 1 within class/object var lines =<< trim END vim9script @@ -4478,7 +4478,7 @@ def Test_lockvar_islocked_notfound() var obj = C.new() obj.Islocked("this.notobjmember") END - v9.CheckSourceFailure(lines, 'E1326: Variable not found on object "C": notobjmember') + v9.CheckSourceFailure(lines, 'E1326: Variable "notobjmember" not found in object "C"') # access a script variable through methods lines =<< trim END @@ -4938,7 +4938,7 @@ def Test_private_class_method() var c = C.new() assert_equal(1234, C._Foo()) END - v9.CheckSourceFailure(lines, 'E1325: Method not found on class "C": _Foo', 16) + v9.CheckSourceFailure(lines, 'E1325: Method "_Foo" not found in class "C"', 16) enddef " Test for using the return value of a class/object method as a function @@ -5227,7 +5227,7 @@ def Test_private_member_access_outside_class() enddef T() END - v9.CheckSourceFailure(lines, 'E1326: Variable not found on object "A": _a', 2) + v9.CheckSourceFailure(lines, 'E1326: Variable "_a" not found in object "A"', 2) # private static member variable lines =<< trim END @@ -5384,7 +5384,7 @@ def Test_class_variable_access_using_object() var a = A.new() echo a.svar2 END - v9.CheckSourceFailure(lines, 'E1337: Class variable "svar2" not found in class "A"', 8) + v9.CheckSourceFailure(lines, 'E1375: Class variable "svar2" accessible only using class "A"', 8) # Cannot write to a class variable using an object in script context lines =<< trim END @@ -5567,7 +5567,26 @@ def Test_abstract_method() enddef endclass END - v9.CheckSourceSuccess(lines) + v9.CheckSourceFailure(lines, 'E1404: Abstract cannot be used in an interface', 3) + + # Use abstract static method in an interface + lines =<< trim END + vim9script + interface A + abstract static def Foo() + enddef + endinterface + END + v9.CheckSourceFailure(lines, 'E1404: Abstract cannot be used in an interface', 3) + + # Use abstract static variable in an interface + lines =<< trim END + vim9script + interface A + abstract static foo: number = 10 + endinterface + END + v9.CheckSourceFailure(lines, 'E1404: Abstract cannot be used in an interface', 3) # Abbreviate the "abstract" keyword lines =<< trim END @@ -5585,7 +5604,7 @@ def Test_abstract_method() abstract this.val = 10 endclass END - v9.CheckSourceFailure(lines, 'E1371: Abstract must be followed by "def" or "static"', 3) + v9.CheckSourceFailure(lines, 'E1371: Abstract must be followed by "def"', 3) # Use a static abstract method lines =<< trim END @@ -5593,14 +5612,8 @@ def Test_abstract_method() abstract class A abstract static def Foo(): number endclass - class B extends A - static def Foo(): number - return 4 - enddef - endclass - assert_equal(4, B.Foo()) END - v9.CheckSourceSuccess(lines) + v9.CheckSourceFailure(lines, 'E1371: Abstract must be followed by "def"', 3) # Type mismatch between abstract method and concrete method lines =<< trim END @@ -5616,17 +5629,6 @@ def Test_abstract_method() END v9.CheckSourceFailure(lines, 'E1383: Method "Foo": type mismatch, expected func(string, number): list but got func(number, string): list', 9) - # Use an abstract class to invoke an abstract method - # FIXME: This should fail - lines =<< trim END - vim9script - abstract class A - abstract static def Foo() - endclass - A.Foo() - END - v9.CheckSourceSuccess(lines) - # Invoke an abstract method from a def function lines =<< trim END vim9script @@ -5645,6 +5647,18 @@ def Test_abstract_method() Bar(b) END v9.CheckSourceSuccess(lines) + + # Use a static method in an abstract class + lines =<< trim END + vim9script + abstract class A + static def Foo(): string + return 'foo' + enddef + endclass + assert_equal('foo', A.Foo()) + END + v9.CheckSourceSuccess(lines) enddef " Test for calling a class method from a subclass @@ -5859,7 +5873,7 @@ def Test_class_variable() var a = A.new() var i = a.val END - v9.CheckSourceFailure(lines, 'E1337: Class variable "val" not found in class "A"', 7) + v9.CheckSourceFailure(lines, 'E1375: Class variable "val" accessible only using class "A"', 7) # Modifying a class variable using an object at function level lines =<< trim END @@ -8337,4 +8351,238 @@ def Test_classmethod_timer_callback() v9.CheckSourceSuccess(lines) enddef +" Test for using a class variable as the first and/or second operand of a binary +" operator. +def Test_class_variable_as_operands() + var lines =<< trim END + vim9script + class Tests + static truthy: bool = true + public static TruthyFn: func + static list: list = [] + static four: number = 4 + static str: string = 'hello' + + static def Str(): string + return str + enddef + + static def Four(): number + return four + enddef + + static def List(): list + return list + enddef + + static def Truthy(): bool + return truthy + enddef + + def TestOps() + assert_true(Tests.truthy == truthy) + assert_true(truthy == Tests.truthy) + assert_true(Tests.list isnot []) + assert_true([] isnot Tests.list) + assert_equal(2, Tests.four >> 1) + assert_equal(16, 1 << Tests.four) + assert_equal(8, Tests.four + four) + assert_equal(8, four + Tests.four) + assert_equal('hellohello', Tests.str .. str) + assert_equal('hellohello', str .. Tests.str) + + # Using class variable for list indexing + var l = range(10) + assert_equal(4, l[Tests.four]) + assert_equal([4, 5, 6], l[Tests.four : Tests.four + 2]) + + # Using class variable for Dict key + var d = {hello: 'abc'} + assert_equal('abc', d[Tests.str]) + enddef + endclass + + def TestOps2() + assert_true(Tests.truthy == Tests.Truthy()) + assert_true(Tests.Truthy() == Tests.truthy) + assert_true(Tests.truthy == Tests.TruthyFn()) + assert_true(Tests.TruthyFn() == Tests.truthy) + assert_true(Tests.list is Tests.List()) + assert_true(Tests.List() is Tests.list) + assert_equal(2, Tests.four >> 1) + assert_equal(16, 1 << Tests.four) + assert_equal(8, Tests.four + Tests.Four()) + assert_equal(8, Tests.Four() + Tests.four) + assert_equal('hellohello', Tests.str .. Tests.Str()) + assert_equal('hellohello', Tests.Str() .. Tests.str) + + # Using class variable for list indexing + var l = range(10) + assert_equal(4, l[Tests.four]) + assert_equal([4, 5, 6], l[Tests.four : Tests.four + 2]) + + # Using class variable for Dict key + var d = {hello: 'abc'} + assert_equal('abc', d[Tests.str]) + enddef + + Tests.TruthyFn = Tests.Truthy + var t = Tests.new() + t.TestOps() + TestOps2() + + assert_true(Tests.truthy == Tests.Truthy()) + assert_true(Tests.Truthy() == Tests.truthy) + assert_true(Tests.truthy == Tests.TruthyFn()) + assert_true(Tests.TruthyFn() == Tests.truthy) + assert_true(Tests.list is Tests.List()) + assert_true(Tests.List() is Tests.list) + assert_equal(2, Tests.four >> 1) + assert_equal(16, 1 << Tests.four) + assert_equal(8, Tests.four + Tests.Four()) + assert_equal(8, Tests.Four() + Tests.four) + assert_equal('hellohello', Tests.str .. Tests.Str()) + assert_equal('hellohello', Tests.Str() .. Tests.str) + + # Using class variable for list indexing + var l = range(10) + assert_equal(4, l[Tests.four]) + assert_equal([4, 5, 6], l[Tests.four : Tests.four + 2]) + + # Using class variable for Dict key + var d = {hello: 'abc'} + assert_equal('abc', d[Tests.str]) + END + v9.CheckSourceSuccess(lines) +enddef + +" Test for checking the type of the key used to access an object dict member. +def Test_dict_member_key_type_check() + var lines =<< trim END + vim9script + + abstract class State + this.numbers: dict = {0: 'nil', 1: 'unity'} + endclass + + class Test extends State + def ObjMethodTests() + var cursor: number = 0 + var z: number = 0 + [this.numbers[cursor]] = ['zero.1'] + assert_equal({0: 'zero.1', 1: 'unity'}, this.numbers) + [this.numbers[string(cursor)], z] = ['zero.2', 1] + assert_equal({0: 'zero.2', 1: 'unity'}, this.numbers) + [z, this.numbers[string(cursor)]] = [1, 'zero.3'] + assert_equal({0: 'zero.3', 1: 'unity'}, this.numbers) + [this.numbers[cursor], z] = ['zero.4', 1] + assert_equal({0: 'zero.4', 1: 'unity'}, this.numbers) + [z, this.numbers[cursor]] = [1, 'zero.5'] + assert_equal({0: 'zero.5', 1: 'unity'}, this.numbers) + enddef + + static def ClassMethodTests(that: State) + var cursor: number = 0 + var z: number = 0 + [that.numbers[cursor]] = ['zero.1'] + assert_equal({0: 'zero.1', 1: 'unity'}, that.numbers) + [that.numbers[string(cursor)], z] = ['zero.2', 1] + assert_equal({0: 'zero.2', 1: 'unity'}, that.numbers) + [z, that.numbers[string(cursor)]] = [1, 'zero.3'] + assert_equal({0: 'zero.3', 1: 'unity'}, that.numbers) + [that.numbers[cursor], z] = ['zero.4', 1] + assert_equal({0: 'zero.4', 1: 'unity'}, that.numbers) + [z, that.numbers[cursor]] = [1, 'zero.5'] + assert_equal({0: 'zero.5', 1: 'unity'}, that.numbers) + enddef + + def new() + enddef + + def newMethodTests() + var cursor: number = 0 + var z: number + [this.numbers[cursor]] = ['zero.1'] + assert_equal({0: 'zero.1', 1: 'unity'}, this.numbers) + [this.numbers[string(cursor)], z] = ['zero.2', 1] + assert_equal({0: 'zero.2', 1: 'unity'}, this.numbers) + [z, this.numbers[string(cursor)]] = [1, 'zero.3'] + assert_equal({0: 'zero.3', 1: 'unity'}, this.numbers) + [this.numbers[cursor], z] = ['zero.4', 1] + assert_equal({0: 'zero.4', 1: 'unity'}, this.numbers) + [z, this.numbers[cursor]] = [1, 'zero.5'] + assert_equal({0: 'zero.5', 1: 'unity'}, this.numbers) + enddef + endclass + + def DefFuncTests(that: Test) + var cursor: number = 0 + var z: number + [that.numbers[cursor]] = ['zero.1'] + assert_equal({0: 'zero.1', 1: 'unity'}, that.numbers) + [that.numbers[string(cursor)], z] = ['zero.2', 1] + assert_equal({0: 'zero.2', 1: 'unity'}, that.numbers) + [z, that.numbers[string(cursor)]] = [1, 'zero.3'] + assert_equal({0: 'zero.3', 1: 'unity'}, that.numbers) + [that.numbers[cursor], z] = ['zero.4', 1] + assert_equal({0: 'zero.4', 1: 'unity'}, that.numbers) + [z, that.numbers[cursor]] = [1, 'zero.5'] + assert_equal({0: 'zero.5', 1: 'unity'}, that.numbers) + enddef + + Test.newMethodTests() + Test.new().ObjMethodTests() + Test.ClassMethodTests(Test.new()) + DefFuncTests(Test.new()) + + const test: Test = Test.new() + var cursor: number = 0 + [test.numbers[cursor], cursor] = ['zero', 1] + [cursor, test.numbers[cursor]] = [1, 'one'] + assert_equal({0: 'zero', 1: 'one'}, test.numbers) + END + v9.CheckSourceSuccess(lines) + + lines =<< trim END + vim9script + + class A + this.numbers: dict = {a: '1', b: '2'} + + def new() + enddef + + def Foo() + var z: number + [this.numbers.a, z] = [{}, 10] + enddef + endclass + + var a = A.new() + a.Foo() + END + v9.CheckSourceFailure(lines, 'E1012: Type mismatch; expected string but got dict', 2) + + lines =<< trim END + vim9script + + class A + this.numbers: dict = {a: 1, b: 2} + + def new() + enddef + + def Foo() + var x: string = 'a' + var y: number + [this.numbers[x], y] = [{}, 10] + enddef + endclass + + var a = A.new() + a.Foo() + END + v9.CheckSourceFailure(lines, 'E1012: Type mismatch; expected number but got dict', 3) +enddef + " vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker diff --git a/src/testdir/test_vim9_func.vim b/src/testdir/test_vim9_func.vim index 701a2f085d..cbbd572640 100644 --- a/src/testdir/test_vim9_func.vim +++ b/src/testdir/test_vim9_func.vim @@ -1995,7 +1995,7 @@ def Test_varargs_mismatch() var res = Map((v) => str2nr(v)) assert_equal(12, res) END - v9.CheckScriptFailure(lines, 'E1013: Argument 1: type mismatch, expected func(...any): number but got func(any): number') + v9.CheckScriptFailure(lines, 'E1180: Variable arguments type must be a list: any') enddef def Test_using_var_as_arg() @@ -2764,7 +2764,7 @@ def Test_func_type_fails() v9.CheckDefFailure(['var Ref1: func()', 'Ref1 = g:FuncOneArgRetNumber'], 'E1012: Type mismatch; expected func() but got func(number): number') v9.CheckDefFailure(['var Ref1: func(bool)', 'Ref1 = g:FuncTwoArgNoRet'], 'E1012: Type mismatch; expected func(bool) but got func(bool, number)') v9.CheckDefFailure(['var Ref1: func(?bool)', 'Ref1 = g:FuncTwoArgNoRet'], 'E1012: Type mismatch; expected func(?bool) but got func(bool, number)') - v9.CheckDefFailure(['var Ref1: func(...bool)', 'Ref1 = g:FuncTwoArgNoRet'], 'E1012: Type mismatch; expected func(...bool) but got func(bool, number)') + v9.CheckDefFailure(['var Ref1: func(...bool)', 'Ref1 = g:FuncTwoArgNoRet'], 'E1180: Variable arguments type must be a list: bool') v9.CheckDefFailure(['var RefWrong: func(string ,number)'], 'E1068:') v9.CheckDefFailure(['var RefWrong: func(string,number)'], 'E1069:') diff --git a/src/testdir/test_vim9_script.vim b/src/testdir/test_vim9_script.vim index a16c5ae198..b64f05e89d 100644 --- a/src/testdir/test_vim9_script.vim +++ b/src/testdir/test_vim9_script.vim @@ -4686,6 +4686,103 @@ def Test_refer_funcref_instr_after_realloc() v9.CheckScriptSuccess(lines) enddef +" Test for calling a deferred function after an exception +def Test_defer_after_exception() + var lines =<< trim END + vim9script + + var callTrace: list = [] + def Bar() + callTrace += [1] + throw 'InnerException' + enddef + + def Defer() + callTrace += [2] + callTrace += [3] + try + Bar() + catch /InnerException/ + callTrace += [4] + endtry + callTrace += [5] + callTrace += [6] + enddef + + def Foo() + defer Defer() + throw "TestException" + enddef + + try + Foo() + catch /TestException/ + callTrace += [7] + endtry + + assert_equal([2, 3, 1, 4, 5, 6, 7], callTrace) + END + v9.CheckSourceSuccess(lines) +enddef + +" Test for multiple deferred function which throw exceptions. +" Exceptions thrown by deferred functions should result in error messages but +" not propagated into the calling functions. +def Test_multidefer_with_exception() + var lines =<< trim END + vim9script + + var callTrace: list = [] + def Except() + callTrace += [1] + throw 'InnerException' + callTrace += [2] + enddef + + def FirstDefer() + callTrace += [3] + callTrace += [4] + enddef + + def SecondDeferWithExcept() + callTrace += [5] + Except() + callTrace += [6] + enddef + + def ThirdDefer() + callTrace += [7] + callTrace += [8] + enddef + + def Foo() + callTrace += [9] + defer FirstDefer() + defer SecondDeferWithExcept() + defer ThirdDefer() + callTrace += [10] + enddef + + v:errmsg = '' + try + callTrace += [11] + Foo() + callTrace += [12] + catch /TestException/ + callTrace += [13] + catch + callTrace += [14] + finally + callTrace += [15] + endtry + callTrace += [16] + + assert_equal('E605: Exception not caught: InnerException', v:errmsg) + assert_equal([11, 9, 10, 7, 8, 5, 1, 3, 4, 12, 15, 16], callTrace) + END + v9.CheckSourceSuccess(lines) +enddef + " Keep this last, it messes up highlighting. def Test_substitute_cmd() new diff --git a/src/testdir/test_vim9_typealias.vim b/src/testdir/test_vim9_typealias.vim new file mode 100644 index 0000000000..bb3efb867c --- /dev/null +++ b/src/testdir/test_vim9_typealias.vim @@ -0,0 +1,539 @@ +" Test Vim9 type aliases + +source check.vim +import './vim9.vim' as v9 + +" Test for :type command to create type aliases +def Test_typealias() + # Use type alias at script level + var lines =<< trim END + vim9script + type ListOfStrings = list + def Foo(a: ListOfStrings): ListOfStrings + return a + enddef + var b: ListOfStrings = ['a', 'b'] + assert_equal(['a', 'b'], b) + assert_equal(['e', 'f'], Foo(['e', 'f'])) + assert_equal('typealias>', typename(ListOfStrings)) + assert_equal(v:t_typealias, type(ListOfStrings)) + assert_equal('ListOfStrings', string(ListOfStrings)) + assert_equal(false, null == ListOfStrings) + END + v9.CheckSourceSuccess(lines) + + # Use type alias at def function level + lines =<< trim END + vim9script + type ListOfStrings = list + def Foo(a: ListOfStrings): ListOfStrings + return a + enddef + def Bar() + var c: ListOfStrings = ['c', 'd'] + assert_equal(['c', 'd'], c) + assert_equal(['e', 'f'], Foo(['e', 'f'])) + assert_equal('typealias>', typename(ListOfStrings)) + assert_equal(v:t_typealias, type(ListOfStrings)) + assert_equal('ListOfStrings', string(ListOfStrings)) + assert_equal(false, null == ListOfStrings) + enddef + Bar() + END + v9.CheckSourceSuccess(lines) + + # Use :type outside a Vim9 script + lines =<< trim END + type Index = number + END + v9.CheckSourceFailure(lines, 'E1393: Type can only be defined in Vim9 script', 1) + + # Use :type without any arguments + lines =<< trim END + vim9script + type + END + v9.CheckSourceFailure(lines, 'E1397: Missing type alias name', 2) + + # Use :type with a name but no type + lines =<< trim END + vim9script + type MyType + END + v9.CheckSourceFailure(lines, "E398: Missing '=': ", 2) + + # Use :type with a name but no type following "=" + lines =<< trim END + vim9script + type MyType = + END + v9.CheckSourceFailure(lines, 'E1398: Missing type alias type', 2) + + # No space before or after "=" + lines =<< trim END + vim9script + type MyType=number + END + v9.CheckSourceFailure(lines, 'E1315: White space required after name: MyType=number', 2) + + # No space after "=" + lines =<< trim END + vim9script + type MyType =number + END + v9.CheckSourceFailure(lines, "E1069: White space required after '=': =number", 2) + + # type alias without "=" + lines =<< trim END + vim9script + type Index number + END + v9.CheckSourceFailure(lines, "E398: Missing '=': number", 2) + + # type alias for a non-existing type + lines =<< trim END + vim9script + type Index = integer + END + v9.CheckSourceFailure(lines, 'E1010: Type not recognized: integer', 2) + + # type alias starting with lower-case letter + lines =<< trim END + vim9script + type index = number + END + v9.CheckSourceFailure(lines, 'E1394: Type name must start with an uppercase letter: index = number', 2) + + # No white space following the alias name + lines =<< trim END + vim9script + type Index:number + END + v9.CheckSourceFailure(lines, 'E1315: White space required after name: Index:number', 2) + + # something following the type alias + lines =<< trim END + vim9script + type ListOfNums = list string + END + v9.CheckSourceFailure(lines, 'E488: Trailing characters: string', 2) + + # type alias name collides with a variable name + lines =<< trim END + vim9script + var ListOfNums: number = 10 + type ListOfNums = list + END + v9.CheckSourceFailure(lines, 'E1041: Redefining script item: "ListOfNums"', 3) + + # duplicate type alias name + lines =<< trim END + vim9script + type MyList = list + type MyList = list + END + v9.CheckSourceFailure(lines, 'E1396: Type alias "MyList" already exists', 3) + + # def function argument name collision with a type alias + lines =<< trim END + vim9script + type A = list + def Foo(A: number) + enddef + END + v9.CheckSourceFailure(lines, 'E1168: Argument already declared in the script: A: number)', 3) + + # def function local variable name collision with a type alias + lines =<< trim END + vim9script + type A = list + def Foo() + var A: number = 10 + enddef + Foo() + END + v9.CheckSourceFailure(lines, 'E1054: Variable already declared in the script: A', 1) + + # type alias a variable + lines =<< trim END + vim9script + var A: list = [] + type B = A + END + v9.CheckSourceFailure(lines, 'E1010: Type not recognized: A', 3) + + # type alias a class + lines =<< trim END + vim9script + class C + endclass + type AC = C + assert_equal('class', typename(AC)) + END + v9.CheckSourceSuccess(lines) + + # Sourcing a script twice (which will free script local variables) + # Uses "lines" from the previous test + new + setline(1, lines) + :source + :source + bw! + + # type alias a type alias + lines =<< trim END + vim9script + type A = string + type B = A + var b: B = 'abc' + assert_equal('abc', b) + def Foo() + var c: B = 'def' + assert_equal('def', c) + enddef + Foo() + END + v9.CheckSourceSuccess(lines) + + # Assigning to a type alias (script level) + lines =<< trim END + vim9script + type MyType = list + MyType = [1, 2, 3] + END + v9.CheckSourceFailure(lines, 'E1395: Type alias "MyType" cannot be modified', 3) + + # Assigning a type alias (def function level) + lines =<< trim END + vim9script + type A = list + def Foo() + var x = A + enddef + Foo() + END + v9.CheckSourceFailure(lines, 'E1403: Type alias "A" cannot be used as a value', 1) + + # Using type alias in an expression (script level) + lines =<< trim END + vim9script + type MyType = list + assert_fails('var m = MyType', 'E1403: Type alias "MyType" cannot be used as a value') + assert_fails('var i = MyType + 1', 'E1400: Using type alias "MyType" as a Number') + assert_fails('var f = 1.0 + MyType', 'E1400: Using type alias "MyType" as a Number') + assert_fails('MyType += 10', 'E1395: Type alias "MyType" cannot be modified') + assert_fails('var x = $"-{MyType}-"', 'E1402: Using type alias "MyType" as a String') + assert_fails('var x = MyType[1]', 'E909: Cannot index a special variable') + END + v9.CheckSourceSuccess(lines) + + # Using type alias in an expression (def function level) + lines =<< trim END + vim9script + type MyType = list + def Foo() + var x = MyType + 1 + enddef + Foo() + END + v9.CheckSourceFailure(lines, 'E1051: Wrong argument type for +', 1) + + # Using type alias in an expression (def function level) + lines =<< trim END + vim9script + type MyType = list + def Foo() + MyType = list + enddef + Foo() + END + v9.CheckSourceFailure(lines, 'E46: Cannot change read-only variable "MyType"', 1) + + # Using type alias in an expression (def function level) + lines =<< trim END + vim9script + type MyType = list + def Foo() + MyType += 10 + enddef + Foo() + END + v9.CheckSourceFailure(lines, 'E46: Cannot change read-only variable "MyType"', 1) + + # Convert type alias to a string (def function level) + lines =<< trim END + vim9script + type MyType = list + def Foo() + var x = $"-{MyType}-" + enddef + Foo() + END + v9.CheckSourceFailure(lines, 'E1105: Cannot convert typealias to string', 1) + + # Using type alias as a float + lines =<< trim END + vim9script + type B = number + sort([1.1, B], 'f') + END + v9.CheckSourceFailure(lines, 'E1401: Using type alias "B" as a Float', 3) + + # Creating a typealias in a def function + lines =<< trim END + vim9script + def Foo() + var n: number = 10 + type A = list + enddef + defcompile + END + v9.CheckSourceFailure(lines, 'E1399: Type can only be used in a script', 2) + + # json_encode should fail with a type alias + lines =<< trim END + vim9script + type A = list + var x = json_encode(A) + END + v9.CheckSourceFailure(lines, 'E1161: Cannot json encode a typealias', 3) + + # Comparing type alias with a number (script level) + lines =<< trim END + vim9script + type A = list + var n: number + var x = A == n + END + v9.CheckSourceFailure(lines, 'E1072: Cannot compare typealias with number', 4) + + # Comparing type alias with a number (def function level) + lines =<< trim END + vim9script + type A = list + def Foo() + var n: number + var x = A == n + enddef + Foo() + END + v9.CheckSourceFailure(lines, 'E1072: Cannot compare typealias with number', 2) + + # casting a number to a type alias (script level) + lines =<< trim END + vim9script + type MyType = bool + assert_equal(true, 1 == true) + END + v9.CheckSourceSuccess(lines) +enddef + +" Test for exporting and importing type aliases +def Test_typealias_import() + var lines =<< trim END + vim9script + export type MyType = list + END + writefile(lines, 'Xtypeexport.vim', 'D') + + lines =<< trim END + vim9script + import './Xtypeexport.vim' as A + + var myList: A.MyType = [1, 2, 3] + def Foo(l: A.MyType) + assert_equal([1, 2, 3], l) + enddef + Foo(myList) + END + v9.CheckScriptSuccess(lines) + + # Use a non existing type alias + lines =<< trim END + vim9script + import './Xtypeexport.vim' as A + + var myNum: A.SomeType = 10 + END + v9.CheckScriptFailure(lines, 'E1010: Type not recognized: A.SomeType = 10', 4) + + # Use a type alias that is not exported + lines =<< trim END + vim9script + type NewType = dict + END + writefile(lines, 'Xtypeexport2.vim', 'D') + lines =<< trim END + vim9script + import './Xtypeexport2.vim' as A + + var myDict: A.NewType = {} + END + v9.CheckScriptFailure(lines, 'E1049: Item not exported in script: NewType', 4) + + # Using the same name as an imported type alias + lines =<< trim END + vim9script + export type MyType2 = list + END + writefile(lines, 'Xtypeexport3.vim', 'D') + lines =<< trim END + vim9script + import './Xtypeexport3.vim' as A + + type MyType2 = A.MyType2 + var myList1: A.MyType2 = [1, 2, 3] + var myList2: MyType2 = [4, 5, 6] + assert_equal([1, 2, 3], myList1) + assert_equal([4, 5, 6], myList2) + END + v9.CheckScriptSuccess(lines) + + # Using an exported class to create a type alias + lines =<< trim END + vim9script + export class MyClass + this.val = 10 + endclass + END + writefile(lines, 'Xtypeexport4.vim', 'D') + lines =<< trim END + vim9script + import './Xtypeexport4.vim' as T + + type MyType3 = T.MyClass + var c: MyType3 = MyType3.new() + assert_equal(10, c.val) + END + v9.CheckScriptSuccess(lines) +enddef + +" Test for using typealias as a def function argument and return type +def Test_typealias_func_argument() + var lines =<< trim END + vim9script + type A = list + def Foo(l: A): A + assert_equal([1, 2], l) + return l + enddef + var x: A = [1, 2] + assert_equal([1, 2], Foo(x)) + END + v9.CheckScriptSuccess(lines) + + # passing a type alias variable to a function expecting a specific type + lines =<< trim END + vim9script + type A = list + def Foo(l: list) + assert_equal([1, 2], l) + enddef + var x: A = [1, 2] + Foo(x) + END + v9.CheckScriptSuccess(lines) + + # passing a type alias variable to a function expecting any + lines =<< trim END + vim9script + type A = list + def Foo(l: any) + assert_equal([1, 2], l) + enddef + var x: A = [1, 2] + Foo(x) + END + v9.CheckScriptSuccess(lines) +enddef + +" Using a type alias with a builtin function +def Test_typealias_with_builtin_functions() + var lines =<< trim END + vim9script + type A = list + assert_equal(0, empty(A)) + END + v9.CheckScriptSuccess(lines) + + # Using a type alias with len() + lines =<< trim END + vim9script + type A = list + var x = len(A) + END + v9.CheckScriptFailure(lines, 'E701: Invalid type for len()', 3) + + # Using a type alias with len() + lines =<< trim END + vim9script + type A = list + def Foo() + var x = len(A) + enddef + Foo() + END + v9.CheckScriptFailure(lines, 'E1013: Argument 1: type mismatch, expected list but got typealias', 1) + + # Using a type alias with eval() + lines =<< trim END + vim9script + type A = number + def Foo() + var x = eval("A") + enddef + Foo() + END + v9.CheckScriptFailure(lines, 'E1403: Type alias "A" cannot be used as a value', 1) +enddef + +" Test for type alias refcount +def Test_typealias_refcount() + var lines =<< trim END + vim9script + type A = list + assert_equal(1, test_refcount(A)) + END + v9.CheckScriptSuccess(lines) + + lines =<< trim END + vim9script + type B = list + var x: B = [] + assert_equal(1, test_refcount(B)) + END + v9.CheckScriptSuccess(lines) +enddef + +" Test for using instanceof() with a type alias +def Test_typealias_instanceof() + var lines =<< trim END + vim9script + class C + endclass + + type Ctype = C + var o = C.new() + assert_equal(1, instanceof(o, Ctype)) + type Ntype = number + assert_fails('instanceof(o, Ntype)', 'E693: List or Class required for argument 2') + assert_equal(1, instanceof(o, [Ctype])) + END + v9.CheckScriptSuccess(lines) +enddef + +" Test for type aliasing a class +def Test_typealias_class() + var lines =<< trim END + vim9script + class C + this.color = 'green' + endclass + type MyClass = C + var o: MyClass = MyClass.new() + assert_equal('green', o.color) + END + v9.CheckScriptSuccess(lines) +enddef + +" vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker diff --git a/src/testdir/test_xxd.vim b/src/testdir/test_xxd.vim index 53e1a95c37..7a2771e033 100644 --- a/src/testdir/test_xxd.vim +++ b/src/testdir/test_xxd.vim @@ -373,6 +373,13 @@ func Test_xxd_revert_bit_dump() bwipe! endfunc +func Test_xxd_roundtrip_large_bit_dump() + new + exe 'r! printf "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" | ' . s:xxd_cmd . ' -b | ' . s:xxd_cmd . ' -r -b' + call assert_match('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ012345678', join(getline(1, 3))) + bwipe! +endfunc + func Test_xxd_version() new exe 'r! ' . s:xxd_cmd . ' -v' diff --git a/src/testing.c b/src/testing.c index fd55927dfb..1835643689 100644 --- a/src/testing.c +++ b/src/testing.c @@ -1132,6 +1132,10 @@ f_test_refcount(typval_T *argvars, typval_T *rettv) if (argvars[0].vval.v_dict != NULL) retval = argvars[0].vval.v_dict->dv_refcount - 1; break; + case VAR_TYPEALIAS: + if (argvars[0].vval.v_typealias != NULL) + retval = argvars[0].vval.v_typealias->ta_refcount - 1; + break; } rettv->v_type = VAR_NUMBER; diff --git a/src/time.c b/src/time.c index 62b38b4bf9..8725a8852c 100644 --- a/src/time.c +++ b/src/time.c @@ -561,13 +561,12 @@ check_due_timer(void) int prev_uncaught_emsg = uncaught_emsg; int save_called_emsg = called_emsg; int save_must_redraw = must_redraw; - int save_trylevel = trylevel; - int save_did_throw = did_throw; - int save_need_rethrow = need_rethrow; int save_ex_pressedreturn = get_pressedreturn(); int save_may_garbage_collect = may_garbage_collect; - except_T *save_current_exception = current_exception; - vimvars_save_T vvsave; + vimvars_save_T vvsave; + exception_state_T estate; + + exception_state_save(&estate); // Create a scope for running the timer callback, ignoring most of // the current scope, such as being inside a try/catch. @@ -576,11 +575,8 @@ check_due_timer(void) called_emsg = 0; did_emsg = FALSE; must_redraw = 0; - trylevel = 0; - did_throw = FALSE; - need_rethrow = FALSE; - current_exception = NULL; may_garbage_collect = FALSE; + exception_state_clear(); save_vimvars(&vvsave); // Invoke the callback. @@ -597,10 +593,7 @@ check_due_timer(void) ++timer->tr_emsg_count; did_emsg = save_did_emsg; called_emsg = save_called_emsg; - trylevel = save_trylevel; - did_throw = save_did_throw; - need_rethrow = save_need_rethrow; - current_exception = save_current_exception; + exception_state_restore(&estate); restore_vimvars(&vvsave); if (must_redraw != 0) need_update_screen = TRUE; diff --git a/src/typval.c b/src/typval.c index 08dd2313f2..078e2eb058 100644 --- a/src/typval.c +++ b/src/typval.c @@ -92,6 +92,10 @@ free_tv(typval_T *varp) object_unref(varp->vval.v_object); break; + case VAR_TYPEALIAS: + typealias_unref(varp->vval.v_typealias); + break; + case VAR_NUMBER: case VAR_FLOAT: case VAR_ANY: @@ -169,6 +173,10 @@ clear_tv(typval_T *varp) object_unref(varp->vval.v_object); varp->vval.v_object = NULL; break; + case VAR_TYPEALIAS: + typealias_unref(varp->vval.v_typealias); + varp->vval.v_typealias = NULL; + break; case VAR_UNKNOWN: case VAR_ANY: case VAR_VOID: @@ -262,6 +270,10 @@ tv_get_bool_or_number_chk( case VAR_VOID: emsg(_(e_cannot_use_void_value)); break; + case VAR_TYPEALIAS: + semsg(_(e_using_typealias_as_number), + varp->vval.v_typealias->ta_name); + break; case VAR_UNKNOWN: case VAR_ANY: case VAR_INSTR: @@ -379,6 +391,10 @@ tv_get_float_chk(typval_T *varp, int *error) case VAR_VOID: emsg(_(e_cannot_use_void_value)); break; + case VAR_TYPEALIAS: + semsg(_(e_using_typealias_as_float), + varp->vval.v_typealias->ta_name); + break; case VAR_UNKNOWN: case VAR_ANY: case VAR_INSTR: @@ -987,13 +1003,24 @@ check_for_object_arg(typval_T *args, int idx) return OK; } +/* + * Returns TRUE if "tv" is a type alias for a class + */ + int +tv_class_alias(typval_T *tv) +{ + return tv->v_type == VAR_TYPEALIAS && + tv->vval.v_typealias->ta_type->tt_type == VAR_OBJECT; +} + /* * Give an error and return FAIL unless "args[idx]" is a class or a list. */ int check_for_class_or_list_arg(typval_T *args, int idx) { - if (args[idx].v_type != VAR_CLASS && args[idx].v_type != VAR_LIST) + if (args[idx].v_type != VAR_CLASS && args[idx].v_type != VAR_LIST + && !tv_class_alias(&args[idx])) { semsg(_(e_list_or_class_required_for_argument_nr), idx + 1); return FAIL; @@ -1129,6 +1156,10 @@ tv_get_string_buf_chk_strict(typval_T *varp, char_u *buf, int strict) case VAR_VOID: emsg(_(e_cannot_use_void_value)); break; + case VAR_TYPEALIAS: + semsg(_(e_using_typealias_as_string), + varp->vval.v_typealias->ta_name); + break; case VAR_UNKNOWN: case VAR_ANY: case VAR_INSTR: @@ -1290,6 +1321,15 @@ copy_tv(typval_T *from, typval_T *to) ++to->vval.v_dict->dv_refcount; } break; + case VAR_TYPEALIAS: + if (from->vval.v_typealias == NULL) + to->vval.v_typealias = NULL; + else + { + to->vval.v_typealias = from->vval.v_typealias; + ++to->vval.v_typealias->ta_refcount; + } + break; case VAR_VOID: emsg(_(e_cannot_use_void_value)); break; @@ -1596,6 +1636,7 @@ typval_compare_null(typval_T *tv1, typval_T *tv2) case VAR_FLOAT: if (!in_vim9script()) return tv->vval.v_float == 0.0; break; + case VAR_TYPEALIAS: return tv->vval.v_typealias == NULL; default: break; } } @@ -2069,6 +2110,9 @@ tv_equal( case VAR_FUNC: return tv1->vval.v_string == tv2->vval.v_string; + case VAR_TYPEALIAS: + return tv1->vval.v_typealias == tv2->vval.v_typealias; + case VAR_UNKNOWN: case VAR_ANY: case VAR_VOID: diff --git a/src/ui.c b/src/ui.c index 9307bb19d6..d841400402 100644 --- a/src/ui.c +++ b/src/ui.c @@ -1055,7 +1055,11 @@ fill_input_buf(int exit_on_error UNUSED) // If a CTRL-C was typed, remove it from the buffer and set // got_int. Also recognize CTRL-C with modifyOtherKeys set, lower // and upper case, in two forms. - if (ctrl_c_interrupts && (inbuf[inbufcount] == 3 + // If terminal key protocols are in use, we expect to receive + // Ctrl_C as an escape sequence, ignore a raw Ctrl_C as this could + // be paste data. + if (ctrl_c_interrupts + && ((inbuf[inbufcount] == Ctrl_C && !key_protocol_enabled()) || (len >= 10 && STRNCMP(inbuf + inbufcount, "\033[27;5;99~", 10) == 0) || (len >= 10 && STRNCMP(inbuf + inbufcount, diff --git a/src/userfunc.c b/src/userfunc.c index a3b8bdc103..5ef0f7d9c9 100644 --- a/src/userfunc.c +++ b/src/userfunc.c @@ -6251,8 +6251,18 @@ handle_defer_one(funccall_T *funccal) char_u *name = dr->dr_name; dr->dr_name = NULL; + // If the deferred function is called after an exception, then only the + // first statement in the function will be executed (because of the + // exception). So save and restore the try/catch/throw exception + // state. + exception_state_T estate; + exception_state_save(&estate); + exception_state_clear(); + call_func(name, -1, &rettv, dr->dr_argcount, dr->dr_argvars, &funcexe); + exception_state_restore(&estate); + clear_tv(&rettv); vim_free(name); for (int i = dr->dr_argcount - 1; i >= 0; --i) diff --git a/src/version.c b/src/version.c index edc9548eb7..606302c0ce 100644 --- a/src/version.c +++ b/src/version.c @@ -719,6 +719,104 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 2092, +/**/ + 2091, +/**/ + 2090, +/**/ + 2089, +/**/ + 2088, +/**/ + 2087, +/**/ + 2086, +/**/ + 2085, +/**/ + 2084, +/**/ + 2083, +/**/ + 2082, +/**/ + 2081, +/**/ + 2080, +/**/ + 2079, +/**/ + 2078, +/**/ + 2077, +/**/ + 2076, +/**/ + 2075, +/**/ + 2074, +/**/ + 2073, +/**/ + 2072, +/**/ + 2071, +/**/ + 2070, +/**/ + 2069, +/**/ + 2068, +/**/ + 2067, +/**/ + 2066, +/**/ + 2065, +/**/ + 2064, +/**/ + 2063, +/**/ + 2062, +/**/ + 2061, +/**/ + 2060, +/**/ + 2059, +/**/ + 2058, +/**/ + 2057, +/**/ + 2056, +/**/ + 2055, +/**/ + 2054, +/**/ + 2053, +/**/ + 2052, +/**/ + 2051, +/**/ + 2050, +/**/ + 2049, +/**/ + 2048, +/**/ + 2047, +/**/ + 2046, +/**/ + 2045, +/**/ + 2044, /**/ 2043, /**/ diff --git a/src/vim.h b/src/vim.h index 39acb0e4bf..9ac453d2cc 100644 --- a/src/vim.h +++ b/src/vim.h @@ -2145,9 +2145,10 @@ typedef int sock_T; #define VV_SIZEOFPOINTER 104 #define VV_MAXCOL 105 #define VV_PYTHON3_VERSION 106 +#define VV_TYPE_TYPEALIAS 107 // MacVim-specific values go here -#define VV_OS_APPEARANCE 107 -#define VV_LEN 108 // number of v: vars +#define VV_OS_APPEARANCE 108 +#define VV_LEN 109 // number of v: vars // used for v_number in VAR_BOOL and VAR_SPECIAL #define VVAL_FALSE 0L // VAR_BOOL @@ -2170,6 +2171,7 @@ typedef int sock_T; #define VAR_TYPE_INSTR 11 #define VAR_TYPE_CLASS 12 #define VAR_TYPE_OBJECT 13 +#define VAR_TYPE_TYPEALIAS 15 #define DICT_MAXNEST 100 // maximum nesting of lists and dicts diff --git a/src/vim9class.c b/src/vim9class.c index bfa6149602..e9131fe3ba 100644 --- a/src/vim9class.c +++ b/src/vim9class.c @@ -1558,25 +1558,26 @@ ex_class(exarg_T *eap) } if (!is_class) - // ignore "abstract" in an interface (as all the methods in an - // interface are abstract. - p = skipwhite(pa + 8); - else { - if (!is_abstract) - { - semsg(_(e_abstract_method_in_concrete_class), pa); - break; - } + // "abstract" not supported in an interface + emsg(_(e_abstract_cannot_be_used_in_interface)); + break; + } - abstract_method = TRUE; - p = skipwhite(pa + 8); - if (STRNCMP(p, "def", 3) != 0 && STRNCMP(p, "static", 6) != 0) - { - emsg(_(e_abstract_must_be_followed_by_def_or_static)); - break; - } + if (!is_abstract) + { + semsg(_(e_abstract_method_in_concrete_class), pa); + break; + } + + p = skipwhite(pa + 8); + if (STRNCMP(p, "def", 3) != 0) + { + emsg(_(e_abstract_must_be_followed_by_def)); + break; } + + abstract_method = TRUE; } int has_static = FALSE; @@ -2095,12 +2096,132 @@ ex_enum(exarg_T *eap UNUSED) } /* - * Handle ":type". + * Type aliases (:type) + */ + + void +typealias_free(typealias_T *ta) +{ + // ta->ta_type is freed in clear_type_list() + vim_free(ta->ta_name); + vim_free(ta); +} + + void +typealias_unref(typealias_T *ta) +{ + if (ta != NULL && --ta->ta_refcount <= 0) + typealias_free(ta); +} + +/* + * Handle ":type". Create an alias for a type specification. */ void ex_type(exarg_T *eap UNUSED) { - // TODO + char_u *arg = eap->arg; + + if (!current_script_is_vim9() + || (cmdmod.cmod_flags & CMOD_LEGACY) + || !getline_equal(eap->getline, eap->cookie, getsourceline)) + { + emsg(_(e_type_can_only_be_defined_in_vim9_script)); + return; + } + + if (*arg == NUL) + { + emsg(_(e_missing_typealias_name)); + return; + } + + if (!ASCII_ISUPPER(*arg)) + { + semsg(_(e_type_name_must_start_with_uppercase_letter_str), arg); + return; + } + + char_u *name_end = find_name_end(arg, NULL, NULL, FNE_CHECK_START); + if (!IS_WHITE_OR_NUL(*name_end)) + { + semsg(_(e_white_space_required_after_name_str), arg); + return; + } + char_u *name_start = arg; + + arg = skipwhite(name_end); + if (*arg != '=') + { + semsg(_(e_missing_equal_str), arg); + return; + } + if (!IS_WHITE_OR_NUL(*(arg + 1))) + { + semsg(_(e_white_space_required_after_str_str), "=", arg); + return; + } + arg++; + arg = skipwhite(arg); + + if (*arg == NUL) + { + emsg(_(e_missing_typealias_type)); + return; + } + + scriptitem_T *si = SCRIPT_ITEM(current_sctx.sc_sid); + type_T *type = parse_type(&arg, &si->sn_type_list, TRUE); + if (type == NULL) + return; + + if (*arg != NUL) + { + // some text after the type + semsg(_(e_trailing_characters_str), arg); + return; + } + + int cc = *name_end; + *name_end = NUL; + + typval_T tv; + tv.v_type = VAR_UNKNOWN; + if (eval_variable_import(name_start, &tv) == OK) + { + if (tv.v_type == VAR_TYPEALIAS) + semsg(_(e_typealias_already_exists_for_str), name_start); + else + semsg(_(e_redefining_script_item_str), name_start); + clear_tv(&tv); + goto done; + } + + // Create a script-local variable for the type alias. + if (type->tt_type != VAR_OBJECT) + { + tv.v_type = VAR_TYPEALIAS; + tv.v_lock = 0; + tv.vval.v_typealias = ALLOC_CLEAR_ONE(typealias_T); + ++tv.vval.v_typealias->ta_refcount; + tv.vval.v_typealias->ta_name = vim_strsave(name_start); + tv.vval.v_typealias->ta_type = type; + } + else + { + // When creating a type alias for a class, use the class type itself to + // create the type alias variable. This is needed to use the type + // alias to invoke class methods (e.g. new()) and use class variables. + tv.v_type = VAR_CLASS; + tv.v_lock = 0; + tv.vval.v_class = type->tt_class; + ++tv.vval.v_class->class_refcount; + } + set_var_const(name_start, current_sctx.sc_sid, NULL, &tv, FALSE, + ASSIGN_CONST | ASSIGN_FINAL, 0); + +done: + *name_end = cc; } /* @@ -2340,7 +2461,7 @@ class_object_index( } if (did_emsg == did_emsg_save) - member_not_found_msg(cl, is_object, name, len); + member_not_found_msg(cl, rettv->v_type, name, len); } return FAIL; @@ -2973,8 +3094,8 @@ method_not_found_msg(class_T *cl, vartype_T v_type, char_u *name, size_t len) method_name, cl->class_name); } else - semsg(_(e_method_not_found_on_class_str_str), cl->class_name, - method_name); + semsg(_(e_method_not_found_on_class_str_str), method_name, + cl->class_name); vim_free(method_name); } @@ -2992,8 +3113,8 @@ member_not_found_msg(class_T *cl, vartype_T v_type, char_u *name, size_t len) semsg(_(e_class_variable_str_accessible_only_using_class_str), varname, cl->class_name); else - semsg(_(e_variable_not_found_on_object_str_str), cl->class_name, - varname); + semsg(_(e_variable_not_found_on_object_str_str), varname, + cl->class_name); } else { @@ -3048,6 +3169,7 @@ f_instanceof(typval_T *argvars, typval_T *rettv) typval_T *object_tv = &argvars[0]; typval_T *classinfo_tv = &argvars[1]; listitem_T *li; + class_T *c; rettv->vval.v_number = VVAL_FALSE; @@ -3062,25 +3184,35 @@ f_instanceof(typval_T *argvars, typval_T *rettv) { FOR_ALL_LIST_ITEMS(classinfo_tv->vval.v_list, li) { - if (li->li_tv.v_type != VAR_CLASS) + if (li->li_tv.v_type != VAR_CLASS && !tv_class_alias(&li->li_tv)) { emsg(_(e_class_required)); return; } - if (class_instance_of(object_tv->vval.v_object->obj_class, - li->li_tv.vval.v_class) == TRUE) + if (li->li_tv.v_type == VAR_TYPEALIAS) + c = li->li_tv.vval.v_typealias->ta_type->tt_class; + else + c = li->li_tv.vval.v_class; + + if (class_instance_of(object_tv->vval.v_object->obj_class, c) + == TRUE) { rettv->vval.v_number = VVAL_TRUE; return; } } + + return; } - else if (classinfo_tv->v_type == VAR_CLASS) - { - rettv->vval.v_number = class_instance_of(object_tv->vval.v_object->obj_class, - classinfo_tv->vval.v_class); - } + + if (classinfo_tv->v_type == VAR_TYPEALIAS) + c = classinfo_tv->vval.v_typealias->ta_type->tt_class; + else + c = classinfo_tv->vval.v_class; + + rettv->vval.v_number = + class_instance_of(object_tv->vval.v_object->obj_class, c); } #endif // FEAT_EVAL diff --git a/src/vim9compile.c b/src/vim9compile.c index 03e79f5655..8a44376848 100644 --- a/src/vim9compile.c +++ b/src/vim9compile.c @@ -1327,11 +1327,12 @@ assignment_len(char_u *p, int *heredoc) /* * Generate the load instruction for "name". */ - static void + static int generate_loadvar(cctx_T *cctx, lhs_T *lhs) { char_u *name = lhs->lhs_name; type_T *type = lhs->lhs_type; + int res = OK; switch (lhs->lhs_dest) { @@ -1360,7 +1361,7 @@ generate_loadvar(cctx_T *cctx, lhs_T *lhs) generate_LOAD(cctx, ISN_LOADT, 0, name + 2, type); break; case dest_script: - compile_load_scriptvar(cctx, + res = compile_load_scriptvar(cctx, name + (name[1] == ':' ? 2 : 0), NULL, NULL); break; case dest_env: @@ -1392,6 +1393,8 @@ generate_loadvar(cctx_T *cctx, lhs_T *lhs) // list or dict value should already be on the stack. break; } + + return res; } /* @@ -2040,9 +2043,7 @@ compile_lhs( lhs->lhs_member_type = m->ocm_type; } else - { lhs->lhs_member_type = lhs->lhs_type->tt_member; - } } return OK; } @@ -2223,18 +2224,21 @@ compile_load_lhs( // Now we can properly check the type. The variable is indexed, thus // we need the member type. For a class or object we don't know the // type yet, it depends on what member is used. + // The top item in the stack is the Dict, followed by the key and then + // the type of the value. vartype_T vartype = lhs->lhs_type->tt_type; type_T *member_type = lhs->lhs_type->tt_member; if (rhs_type != NULL && member_type != NULL && vartype != VAR_OBJECT && vartype != VAR_CLASS && rhs_type != &t_void && need_type(rhs_type, member_type, FALSE, - -2, 0, cctx, FALSE, FALSE) == FAIL) + -3, 0, cctx, FALSE, FALSE) == FAIL) return FAIL; + + return OK; } - else - generate_loadvar(cctx, lhs); - return OK; + + return generate_loadvar(cctx, lhs); } /* @@ -2292,7 +2296,8 @@ compile_load_lhs_with_index(lhs_T *lhs, char_u *var_start, cctx_T *cctx) return generate_CLASSMEMBER(cctx, TRUE, cl, lhs->lhs_member_idx); } - compile_load_lhs(lhs, var_start, NULL, cctx); + if (compile_load_lhs(lhs, var_start, NULL, cctx) == FAIL) + return FAIL; if (lhs->lhs_has_index) { @@ -2501,6 +2506,7 @@ push_default_value( case VAR_VOID: case VAR_INSTR: case VAR_CLASS: + case VAR_TYPEALIAS: case VAR_SPECIAL: // cannot happen // This is skipped for local variables, they are always // initialized to zero. But in a "for" or "while" loop @@ -3954,6 +3960,11 @@ compile_def_function( line = (char_u *)""; break; + case CMD_type: + emsg(_(e_type_can_only_be_used_in_script)); + goto erret; + break; + case CMD_global: if (check_global_and_subst(ea.cmd, p) == FAIL) goto erret; diff --git a/src/vim9execute.c b/src/vim9execute.c index 1fdff84da7..ff54bcb806 100644 --- a/src/vim9execute.c +++ b/src/vim9execute.c @@ -1140,8 +1140,18 @@ invoke_defer_funcs(ectx_T *ectx) char_u *name = functv->vval.v_string; functv->vval.v_string = NULL; + // If the deferred function is called after an exception, then only the + // first statement in the function will be executed (because of the + // exception). So save and restore the try/catch/throw exception + // state. + exception_state_T estate; + exception_state_save(&estate); + exception_state_clear(); + (void)call_func(name, -1, &rettv, argcount, argvars, &funcexe); + exception_state_restore(&estate); + clear_tv(&rettv); vim_free(name); } @@ -3797,6 +3807,13 @@ exec_instructions(ectx_T *ectx) case ISN_STORE: --ectx->ec_stack.ga_len; tv = STACK_TV_VAR(iptr->isn_arg.number); + if (STACK_TV_BOT(0)->v_type == VAR_TYPEALIAS) + { + semsg(_(e_using_typealias_as_value), + STACK_TV_BOT(0)->vval.v_typealias->ta_name); + clear_tv(STACK_TV_BOT(0)); + goto on_error; + } clear_tv(tv); *tv = *STACK_TV_BOT(0); break; @@ -7507,6 +7524,7 @@ tv2bool(typval_T *tv) case VAR_INSTR: case VAR_CLASS: case VAR_OBJECT: + case VAR_TYPEALIAS: break; } return FALSE; diff --git a/src/vim9expr.c b/src/vim9expr.c index 85eb7afb90..feb5df07ca 100644 --- a/src/vim9expr.c +++ b/src/vim9expr.c @@ -238,6 +238,7 @@ compile_member(int is_slice, int *keeping_dict, cctx_T *cctx) case VAR_INSTR: case VAR_CLASS: case VAR_OBJECT: + case VAR_TYPEALIAS: case VAR_UNKNOWN: case VAR_ANY: case VAR_VOID: @@ -379,6 +380,8 @@ compile_class_object_index(cctx_T *cctx, char_u **arg, type_T *type) } if (type->tt_type == VAR_CLASS) { + // Remove the class type from the stack + --cctx->ctx_type_stack.ga_len; if (generate_CLASSMEMBER(cctx, TRUE, cl, m_idx) == FAIL) return FAIL; } @@ -475,6 +478,8 @@ compile_class_object_index(cctx_T *cctx, char_u **arg, type_T *type) } *arg = name_end; + // Remove the class type from the stack + --cctx->ctx_type_stack.ga_len; return generate_CLASSMEMBER(cctx, TRUE, cl, idx); } diff --git a/src/vim9instr.c b/src/vim9instr.c index 8ee9e7c6cd..3547d42f4a 100644 --- a/src/vim9instr.c +++ b/src/vim9instr.c @@ -240,6 +240,7 @@ may_generate_2STRING(int offset, int tolerant, cctx_T *cctx) case VAR_INSTR: case VAR_CLASS: case VAR_OBJECT: + case VAR_TYPEALIAS: to_string_error(type->tt_type); return FAIL; } diff --git a/src/vim9type.c b/src/vim9type.c index 6a5848792b..e5b61052be 100644 --- a/src/vim9type.c +++ b/src/vim9type.c @@ -1231,6 +1231,15 @@ parse_type(char_u **arg, garray_T *type_gap, int give_error) type = parse_type(&p, type_gap, give_error); if (type == NULL) return NULL; + if ((flags & TTFLAG_VARARGS) != 0 + && type->tt_type != VAR_LIST) + { + char *tofree; + semsg(_(e_variable_arguments_type_must_be_list_str), + type_name(type, &tofree)); + vim_free(tofree); + return NULL; + } arg_type[argcount++] = type; // Nothing comes after "...{type}". @@ -1345,7 +1354,9 @@ parse_type(char_u **arg, garray_T *type_gap, int give_error) } // It can be a class or interface name, possibly imported. - typval_T tv; + int did_emsg_before = did_emsg; + typval_T tv; + tv.v_type = VAR_UNKNOWN; if (eval_variable_import(*arg, &tv) == OK) { @@ -1368,11 +1379,22 @@ parse_type(char_u **arg, garray_T *type_gap, int give_error) return type; } } + else if (tv.v_type == VAR_TYPEALIAS) + { + // user defined type + type_T *type = copy_type(tv.vval.v_typealias->ta_type, type_gap); + *arg += len; + clear_tv(&tv); + // Skip over ".TypeName". + while (ASCII_ISALNUM(**arg) || **arg == '_' || **arg == '.') + ++*arg; + return type; + } clear_tv(&tv); } - if (give_error) + if (give_error && (did_emsg == did_emsg_before)) semsg(_(e_type_not_recognized_str), *arg); return NULL; } @@ -1407,6 +1429,7 @@ equal_type(type_T *type1, type_T *type2, int flags) case VAR_INSTR: case VAR_CLASS: case VAR_OBJECT: + case VAR_TYPEALIAS: break; // not composite is always OK case VAR_LIST: case VAR_DICT: @@ -1657,6 +1680,7 @@ vartype_name(vartype_T type) case VAR_INSTR: return "instr"; case VAR_CLASS: return "class"; case VAR_OBJECT: return "object"; + case VAR_TYPEALIAS: return "typealias"; case VAR_FUNC: case VAR_PARTIAL: return "func"; @@ -1786,12 +1810,31 @@ f_typename(typval_T *argvars, typval_T *rettv) rettv->v_type = VAR_STRING; ga_init2(&type_list, sizeof(type_T *), 10); - type = typval2type(argvars, get_copyID(), &type_list, TVTT_DO_MEMBER); + if (argvars[0].v_type == VAR_TYPEALIAS) + { + type = copy_type(argvars[0].vval.v_typealias->ta_type, &type_list); + // A type alias for a class has the type set to VAR_OBJECT. Change it + // to VAR_CLASS, so that the name is "typealias>" + if (type->tt_type == VAR_OBJECT) + type->tt_type = VAR_CLASS; + } + else + type = typval2type(argvars, get_copyID(), &type_list, TVTT_DO_MEMBER); name = type_name(type, &tofree); - if (tofree != NULL) - rettv->vval.v_string = (char_u *)tofree; + if (argvars[0].v_type == VAR_TYPEALIAS) + { + vim_snprintf((char *)IObuff, IOSIZE, "typealias<%s>", name); + rettv->vval.v_string = vim_strsave((char_u *)IObuff); + if (tofree != NULL) + vim_free(tofree); + } else - rettv->vval.v_string = vim_strsave((char_u *)name); + { + if (tofree != NULL) + rettv->vval.v_string = (char_u *)tofree; + else + rettv->vval.v_string = vim_strsave((char_u *)name); + } clear_type_list(&type_list); } diff --git a/src/viminfo.c b/src/viminfo.c index d3281564ee..58bf419194 100644 --- a/src/viminfo.c +++ b/src/viminfo.c @@ -1374,7 +1374,8 @@ write_viminfo_varlist(FILE *fp) case VAR_INSTR: case VAR_CLASS: case VAR_OBJECT: - continue; + case VAR_TYPEALIAS: + continue; } fprintf(fp, "!%s\t%s\t", this_var->di_key, s); if (this_var->di_tv.v_type == VAR_BOOL diff --git a/src/xxd/xxd.c b/src/xxd/xxd.c index 544aa50b95..c90bc027e8 100644 --- a/src/xxd/xxd.c +++ b/src/xxd/xxd.c @@ -88,6 +88,8 @@ #endif #if defined(WIN32) || defined(CYGWIN) # include /* for setmode() */ +#endif +#ifdef WIN32 # include #endif #ifdef UNIX @@ -136,7 +138,7 @@ extern void perror __P((char *)); # endif #endif -char version[] = "xxd 2023-10-08 by Juergen Weigert et al."; +char version[] = "xxd 2023-10-25 by Juergen Weigert et al."; #ifdef WIN32 char osver[] = " (Win32)"; #else @@ -418,19 +420,13 @@ huntype( } else /* HEX_BITS */ { - n1 = parse_hex_digit(c); - if (n1 >= 0) - { - want_off = (want_off << 4) | n1; - } - - if (bt < 0) - { - p = 0; + if (n1 < 0) + { + p = 0; bcnt = 0; - b = 0; - continue; - } + continue; + } + want_off = (want_off << 4) | n1; } continue; }