diff options
28 files changed, 128 insertions, 105 deletions
diff --git a/.github/scripts/build_universal_macos.sh b/.github/scripts/build_universal_macos.sh index 6d9400fb96..d07c395cd6 100755 --- a/.github/scripts/build_universal_macos.sh +++ b/.github/scripts/build_universal_macos.sh @@ -1,26 +1,5 @@ #!/bin/bash -e -echo "Provision universal libintl" -GETTEXT_PREFIX="$(brew --prefix gettext)" -printf 'GETTEXT_PREFIX=%s\n' "$GETTEXT_PREFIX" >> $GITHUB_ENV -bottle_tag="arm64_big_sur" -brew fetch --bottle-tag="$bottle_tag" gettext -cd "$(mktemp -d)" -tar xf "$(brew --cache)"/**/*gettext*${bottle_tag}*.tar.gz -lipo gettext/*/lib/libintl.a "${GETTEXT_PREFIX}/lib/libintl.a" -create -output libintl.a -mv -f libintl.a /usr/local/lib/ - -echo "Ensure static linkage to libintl" -# We're about to mangle `gettext`, so let's remove any potentially broken -# installs (e.g. curl, git) as those could interfere with our build. -brew uninstall $(brew uses --installed --recursive gettext) -brew unlink gettext -ln -sf "$(brew --prefix)/opt/$(readlink "${GETTEXT_PREFIX}")/bin"/* /usr/local/bin/ -ln -sf "$(brew --prefix)/opt/$(readlink "${GETTEXT_PREFIX}")/include"/* /usr/local/include/ -rm -f "$GETTEXT_PREFIX" - -echo "Build release" -cd "$GITHUB_WORKSPACE" MACOSX_DEPLOYMENT_TARGET="$(sw_vers -productVersion | cut -f1 -d.)" export MACOSX_DEPLOYMENT_TARGET cmake -S cmake.deps -B .deps -G Ninja \ diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt index 6de7166f83..48fa953954 100644 --- a/runtime/doc/builtin.txt +++ b/runtime/doc/builtin.txt @@ -5115,8 +5115,6 @@ printf({fmt}, {expr1} ...) *printf()* precision, the argument(s) to be used must also be specified using a {n$} positional argument specifier. See |printf-$|. - - *E1520* The conversion specifiers and their meanings are: *printf-d* *printf-b* *printf-B* *printf-o* *printf-x* *printf-X* @@ -5307,6 +5305,13 @@ printf({fmt}, {expr1} ...) *printf()* < E1505: Invalid format specifier: %1$d at width %2$d is: %01$*2$.3$d + *E1507* + This internal error indicates that the logic to parse a + positional format argument ran into a problem that couldn't be + otherwise reported. Please file a bug against Vim if you run + into this, copying the exact format string and parameters that + were used. + prompt_getprompt({buf}) *prompt_getprompt()* Returns the effective prompt text for buffer {buf}. {buf} can be a buffer name or number. See |prompt-buffer|. diff --git a/runtime/doc/dev_style.txt b/runtime/doc/dev_style.txt index b96b01dbff..79e758a11e 100644 --- a/runtime/doc/dev_style.txt +++ b/runtime/doc/dev_style.txt @@ -846,7 +846,7 @@ Annotate non-trivial fall-through between cases. If not conditional on an enumerated value, switch statements should always have a `default` case (in the case of an enumerated value, the compiler will warn you if any values are not handled). If the default case should never -execute, simply `assert`: >c +execute, simply use `abort()`: >c switch (var) { case 0: @@ -856,7 +856,7 @@ execute, simply `assert`: >c ... break; default: - assert(false); + abort(); } Return Values ~ diff --git a/runtime/ftplugin/gpg.vim b/runtime/ftplugin/gpg.vim index 2415555e09..7fb4f47ed8 100644 --- a/runtime/ftplugin/gpg.vim +++ b/runtime/ftplugin/gpg.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file " Language: gpg(1) configuration file " Previous Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Latest Revision: 2023-10-07 if exists("b:did_ftplugin") finish @@ -17,17 +17,17 @@ setlocal comments=:# commentstring=#\ %s formatoptions-=t formatoptions+=croql if has('unix') && executable('less') if !has('gui_running') - command -buffer -nargs=1 Sman + command -buffer -nargs=1 GpgKeywordPrg \ silent exe '!' . 'LESS= MANPAGER="less --pattern=''^\s+--' . <q-args> . '\b'' --hilite-search" man ' . 'gpg' | \ redraw! elseif has('terminal') - command -buffer -nargs=1 Sman + command -buffer -nargs=1 GpgKeywordPrg \ silent exe ':term ' . 'env LESS= MANPAGER="less --pattern=''' . escape('^\s+--' . <q-args> . '\b', '\') . ''' --hilite-search" man ' . 'gpg' endif - if exists(':Sman') == 2 + if exists(':GpgKeywordPrg') == 2 setlocal iskeyword+=- - setlocal keywordprg=:Sman - let b:undo_ftplugin .= '| setlocal keywordprg< iskeyword< | sil! delc -buffer Sman' + setlocal keywordprg=:GpgKeywordPrg + let b:undo_ftplugin .= '| setlocal keywordprg< iskeyword< | sil! delc -buffer GpgKeywordPrg' endif endif diff --git a/runtime/ftplugin/modconf.vim b/runtime/ftplugin/modconf.vim index d5eda5af21..22d18a9aad 100644 --- a/runtime/ftplugin/modconf.vim +++ b/runtime/ftplugin/modconf.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file " Language: modules.conf(5) configuration file " Previous Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Latest Revision: 2023-10-07 if exists("b:did_ftplugin") finish @@ -18,17 +18,17 @@ setlocal formatoptions-=t formatoptions+=croql if has('unix') && executable('less') if !has('gui_running') - command -buffer -nargs=1 Sman + command -buffer -nargs=1 ModconfKeywordPrg \ silent exe '!' . 'LESS= MANPAGER="less --pattern=''^\s{,8}' . <q-args> . '\b'' --hilite-search" man ' . 'modprobe.d' | \ redraw! elseif has('terminal') - command -buffer -nargs=1 Sman + command -buffer -nargs=1 ModconfKeywordPrg \ silent exe ':term ' . 'env LESS= MANPAGER="less --pattern=''' . escape('^\s{,8}' . <q-args> . '\b', '\') . ''' --hilite-search" man ' . 'modprobe.d' endif - if exists(':Sman') == 2 + if exists(':ModconfKeywordPrg') == 2 setlocal iskeyword+=- - setlocal keywordprg=:Sman - let b:undo_ftplugin .= '| setlocal keywordprg< iskeyword< | sil! delc -buffer Sman' + setlocal keywordprg=:ModconfKeywordPrg + let b:undo_ftplugin .= '| setlocal keywordprg< iskeyword< | sil! delc -buffer ModconfKeywordPrg' endif endif diff --git a/runtime/ftplugin/muttrc.vim b/runtime/ftplugin/muttrc.vim index 7a4eb7a8bb..c9f6df31d0 100644 --- a/runtime/ftplugin/muttrc.vim +++ b/runtime/ftplugin/muttrc.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file " Language: mutt RC File " Previous Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2006-04-19 +" Latest Revision: 2023-10-07 if exists("b:did_ftplugin") finish @@ -20,17 +20,17 @@ let &l:include = '^\s*source\>' if has('unix') && executable('less') if !has('gui_running') - command -buffer -nargs=1 Sman + command -buffer -nargs=1 MuttrcKeywordPrg \ silent exe '!' . 'LESS= MANPAGER="less --pattern=''^\s+' . <q-args> . '\b'' --hilite-search" man ' . 'muttrc' | \ redraw! elseif has('terminal') - command -buffer -nargs=1 Sman + command -buffer -nargs=1 MuttrcKeywordPrg \ silent exe 'term ' . 'env LESS= MANPAGER="less --pattern=''' . escape('^\s+' . <q-args> . '\b', '\') . ''' --hilite-search" man ' . 'muttrc' endif - if exists(':Sman') == 2 + if exists(':MuttrcKeywordPrg') == 2 setlocal iskeyword+=- - setlocal keywordprg=:Sman - let b:undo_ftplugin .= '| setlocal keywordprg< iskeyword< | sil! delc -buffer Sman' + setlocal keywordprg=:MuttrcKeywordPrg + let b:undo_ftplugin .= '| setlocal keywordprg< iskeyword< | sil! delc -buffer MuttrcKeywordPrg' endif endif diff --git a/runtime/ftplugin/readline.vim b/runtime/ftplugin/readline.vim index a696da2701..181d8ac661 100644 --- a/runtime/ftplugin/readline.vim +++ b/runtime/ftplugin/readline.vim @@ -32,17 +32,17 @@ endif if has('unix') && executable('less') if !has('gui_running') - command -buffer -nargs=1 Sman + command -buffer -nargs=1 ReadlineKeywordPrg \ silent exe '!' . 'LESS= MANPAGER="less --pattern=''^\s+' . <q-args> . '\b'' --hilite-search" man ' . '3 readline' | \ redraw! elseif has('terminal') - command -buffer -nargs=1 Sman + command -buffer -nargs=1 ReadlineKeywordPrg \ silent exe 'term ' . 'env LESS= MANPAGER="less --pattern=''' . escape('^\s+' . <q-args> . '\b', '\') . ''' --hilite-search" man ' . '3 readline' endif - if exists(':Sman') == 2 + if exists(':ReadlineKeywordPrg') == 2 setlocal iskeyword+=- - setlocal keywordprg=:Sman - let b:undo_ftplugin .= '| setlocal keywordprg< iskeyword< | sil! delc -buffer Sman' + setlocal keywordprg=:ReadlineKeywordPrg + let b:undo_ftplugin .= '| setlocal keywordprg< iskeyword< | sil! delc -buffer ReadlineKeywordPrg' endif endif diff --git a/runtime/ftplugin/sh.vim b/runtime/ftplugin/sh.vim index c227838d18..c1a6bc5ade 100644 --- a/runtime/ftplugin/sh.vim +++ b/runtime/ftplugin/sh.vim @@ -3,7 +3,8 @@ " Maintainer: Doug Kearns <dougkearns@gmail.com> " Previous Maintainer: Dan Sharp " Contributor: Enno Nagel <ennonagel+vim@gmail.com> -" Last Change: 2023 Aug 29 +" Eisuke Kawashima +" Last Change: 2023 Sep 28 if exists("b:did_ftplugin") finish @@ -39,16 +40,16 @@ if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") let b:undo_ftplugin ..= " | unlet! b:browsefilter" endif -if (exists("b:is_bash") && (b:is_bash == 1)) +if get(b:, "is_bash", 0) if !has("gui_running") && executable("less") - command! -buffer -nargs=1 Help silent exe '!bash -c "{ help "<args>" 2>/dev/null || man "<args>"; } | LESS= less"' | redraw! - elseif has('terminal') - command! -buffer -nargs=1 Help silent exe ':term bash -c "help "<args>" 2>/dev/null || man "<args>""' + command! -buffer -nargs=1 ShKeywordPrg silent exe '!bash -c "{ help "<args>" 2>/dev/null || man "<args>"; } | LESS= less"' | redraw! + elseif has("terminal") + command! -buffer -nargs=1 ShKeywordPrg silent exe ':term bash -c "help "<args>" 2>/dev/null || man "<args>""' else - command! -buffer -nargs=1 Help echo system('bash -c "help <args>" 2>/dev/null || man "<args>"') + command! -buffer -nargs=1 ShKeywordPrg echo system('bash -c "help <args>" 2>/dev/null || man "<args>"') endif - setlocal keywordprg=:Help - let b:undo_ftplugin ..= " | setl kp< | sil! delc -buffer Help" + setlocal keywordprg=:ShKeywordPrg + let b:undo_ftplugin ..= " | setl kp< | sil! delc -buffer ShKeywordPrg" endif let &cpo = s:save_cpo diff --git a/runtime/ftplugin/sshconfig.vim b/runtime/ftplugin/sshconfig.vim index c9a5cfaa68..4a054da52f 100644 --- a/runtime/ftplugin/sshconfig.vim +++ b/runtime/ftplugin/sshconfig.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file " Language: OpenSSH client configuration file " Previous Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Latest Revision: 2023-10-07 if exists("b:did_ftplugin") finish @@ -16,17 +16,17 @@ let b:undo_ftplugin = 'setlocal com< cms< fo<' if has('unix') && executable('less') if !has('gui_running') - command -buffer -nargs=1 Sman + command -buffer -nargs=1 SshconfigKeywordPrg \ silent exe '!' . 'LESS= MANPAGER="less --pattern=''^\s+' . <q-args> . '$'' --hilite-search" man ' . 'ssh_config' | \ redraw! elseif has('terminal') - command -buffer -nargs=1 Sman + command -buffer -nargs=1 SshconfigKeywordPrg \ silent exe 'term ' . 'env LESS= MANPAGER="less --pattern=''' . escape('^\s+' . <q-args> . '$', '\') . ''' --hilite-search" man ' . 'ssh_config' endif - if exists(':Sman') == 2 + if exists(':SshconfigKeywordPrg') == 2 setlocal iskeyword+=- - setlocal keywordprg=:Sman - let b:undo_ftplugin .= '| setlocal keywordprg< iskeyword< | sil! delc -buffer Sman' + setlocal keywordprg=:SshconfigKeywordPrg + let b:undo_ftplugin .= '| setlocal keywordprg< iskeyword< | sil! delc -buffer SshconfigKeywordPrg' endif endif diff --git a/runtime/ftplugin/sudoers.vim b/runtime/ftplugin/sudoers.vim index b4123620af..81ce7906a9 100644 --- a/runtime/ftplugin/sudoers.vim +++ b/runtime/ftplugin/sudoers.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file " Language: sudoers(5) configuration files " Previous Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Latest Revision: 2023-10-07 if exists("b:did_ftplugin") finish @@ -17,17 +17,17 @@ setlocal comments=:# commentstring=#\ %s formatoptions-=t formatoptions+=croql if has('unix') && executable('less') if !has('gui_running') - command -buffer -nargs=1 Sman + command -buffer -nargs=1 SudoersKeywordPrg \ silent exe '!' . 'LESS= MANPAGER="less --pattern=''\b' . <q-args> . '\b'' --hilite-search" man ' . 'sudoers' | \ redraw! elseif has('terminal') - command -buffer -nargs=1 Sman + command -buffer -nargs=1 SudoersKeywordPrg \ silent exe ':term ' . 'env LESS= MANPAGER="less --pattern=''' . escape('\b' . <q-args> . '\b', '\') . ''' --hilite-search" man ' . 'sudoers' endif - if exists(':Sman') == 2 + if exists(':SudoersKeywordPrg') == 2 setlocal iskeyword+=- - setlocal keywordprg=:Sman - let b:undo_ftplugin .= '| setlocal keywordprg< iskeyword< | sil! delc -buffer Sman' + setlocal keywordprg=:SudoersKeywordPrg + let b:undo_ftplugin .= '| setlocal keywordprg< iskeyword< | sil! delc -buffer SudoersKeywordPrg' endif endif diff --git a/runtime/ftplugin/systemd.vim b/runtime/ftplugin/systemd.vim index e60a5e4960..8bcacdd381 100644 --- a/runtime/ftplugin/systemd.vim +++ b/runtime/ftplugin/systemd.vim @@ -1,6 +1,7 @@ " Vim filetype plugin file " Language: systemd.unit(5) " Keyword Lookup Support: Enno Nagel <enno.nagel+vim@gmail.com> +" Latest Revision: 2023-10-07 if !exists('b:did_ftplugin') " Looks a lot like dosini files. @@ -9,11 +10,11 @@ endif if has('unix') && executable('less') if !has('gui_running') - command -buffer -nargs=1 Sman silent exe '!' . KeywordLookup_systemd(<q-args>) | redraw! + command -buffer -nargs=1 SystemdKeywordPrg silent exe '!' . KeywordLookup_systemd(<q-args>) | redraw! elseif has('terminal') - command -buffer -nargs=1 Sman silent exe 'term ' . KeywordLookup_systemd(<q-args>) + command -buffer -nargs=1 SystemdKeywordPrg silent exe 'term ' . KeywordLookup_systemd(<q-args>) endif - if exists(':Sman') == 2 + if exists(':SystemdKeywordPrg') == 2 if !exists('*KeywordLookup_systemd') function KeywordLookup_systemd(keyword) abort let matches = matchlist(getline(search('\v^\s*\[\s*.+\s*\]\s*$', 'nbWz')), '\v^\s*\[\s*(\k+).*\]\s*$') @@ -26,11 +27,11 @@ if has('unix') && executable('less') endfunction endif setlocal iskeyword+=- - setlocal keywordprg=:Sman + setlocal keywordprg=:SystemdKeywordPrg if !exists('b:undo_ftplugin') || empty(b:undo_ftplugin) let b:undo_ftplugin = 'setlocal keywordprg< iskeyword<' else - let b:undo_ftplugin .= '| setlocal keywordprg< iskeyword< | sil! delc -buffer Sman' + let b:undo_ftplugin .= '| setlocal keywordprg< iskeyword< | sil! delc -buffer SystemdKeywordPrg' endif endif endif diff --git a/runtime/ftplugin/udevrules.vim b/runtime/ftplugin/udevrules.vim index 83fb728a54..ec365f04c2 100644 --- a/runtime/ftplugin/udevrules.vim +++ b/runtime/ftplugin/udevrules.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file " Language: udev(8) rules file " Previous Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Latest Revision: 2023-10-07 if exists("b:did_ftplugin") finish @@ -17,17 +17,17 @@ setlocal comments=:# commentstring=#\ %s formatoptions-=t formatoptions+=croql if has('unix') && executable('less') if !has('gui_running') - command -buffer -nargs=1 Sman + command -buffer -nargs=1 UdevrulesKeywordPrg \ silent exe '!' . 'LESS= MANPAGER="less --pattern=''^\s{,8}' . <q-args> . '\b'' --hilite-search" man ' . 'udev' | \ redraw! elseif has('terminal') - command -buffer -nargs=1 Sman + command -buffer -nargs=1 UdevrulesKeywordPrg \ silent exe ':term ' . 'env LESS= MANPAGER="less --pattern=''' . escape('^\s{,8}' . <q-args> . '\b', '\') . ''' --hilite-search" man ' . 'udev' endif - if exists(':Sman') == 2 + if exists(':UdevrulesKeywordPrg') == 2 setlocal iskeyword+=- - setlocal keywordprg=:Sman - let b:undo_ftplugin .= '| setlocal keywordprg< iskeyword< | sil! delc -buffer Sman' + setlocal keywordprg=:UdevrulesKeywordPrg + let b:undo_ftplugin .= '| setlocal keywordprg< iskeyword< | sil! delc -buffer UdevrulesKeywordPrg' endif endif diff --git a/runtime/ftplugin/zsh.vim b/runtime/ftplugin/zsh.vim index ed75d04003..40986fccbe 100644 --- a/runtime/ftplugin/zsh.vim +++ b/runtime/ftplugin/zsh.vim @@ -2,7 +2,7 @@ " Language: Zsh shell script " Maintainer: Christian Brabandt <cb@256bit.org> " Previous Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2021-04-03 +" Latest Revision: 2023-10-07 " License: Vim (see :h license) " Repository: https://github.com/chrisbra/vim-zsh @@ -20,17 +20,17 @@ let b:undo_ftplugin = "setl com< cms< fo< " if executable('zsh') && &shell !~# '/\%(nologin\|false\)$' if !has('gui_running') && executable('less') - command! -buffer -nargs=1 RunHelp silent exe '!MANPAGER= zsh -c "autoload -Uz run-help; run-help <args> 2>/dev/null | LESS= less"' | redraw! + command! -buffer -nargs=1 ZshKeywordPrg silent exe '!MANPAGER= zsh -c "autoload -Uz run-help; run-help <args> 2>/dev/null | LESS= less"' | redraw! elseif has('terminal') - command! -buffer -nargs=1 RunHelp silent exe ':term zsh -c "autoload -Uz run-help; run-help <args>"' + command! -buffer -nargs=1 ZshKeywordPrg silent exe ':term zsh -c "autoload -Uz run-help; run-help <args>"' else - command! -buffer -nargs=1 RunHelp echo system('zsh -c "autoload -Uz run-help; run-help <args> 2>/dev/null"') + command! -buffer -nargs=1 ZshKeywordPrg echo system('zsh -c "autoload -Uz run-help; run-help <args> 2>/dev/null"') endif if !exists('current_compiler') compiler zsh endif - setlocal keywordprg=:RunHelp - let b:undo_ftplugin .= 'keywordprg< | sil! delc -buffer RunHelp' + setlocal keywordprg=:ZshKeywordPrg + let b:undo_ftplugin .= 'keywordprg< | sil! delc -buffer ZshKeywordPrg' endif let b:match_words = '\<if\>:\<elif\>:\<else\>:\<fi\>' diff --git a/runtime/lua/vim/_meta/vimfn.lua b/runtime/lua/vim/_meta/vimfn.lua index 5a3a5f3890..06de2fdd1c 100644 --- a/runtime/lua/vim/_meta/vimfn.lua +++ b/runtime/lua/vim/_meta/vimfn.lua @@ -6098,8 +6098,6 @@ function vim.fn.prevnonblank(lnum) end --- precision, the argument(s) to be used must also be specified --- using a {n$} positional argument specifier. See |printf-$|. --- ---- ---- *E1520* --- The conversion specifiers and their meanings are: --- --- *printf-d* *printf-b* *printf-B* *printf-o* *printf-x* *printf-X* @@ -6290,6 +6288,13 @@ function vim.fn.prevnonblank(lnum) end --- < E1505: Invalid format specifier: --- %1$d at width %2$d is: %01$*2$.3$d --- +--- *E1507* +--- This internal error indicates that the logic to parse a +--- positional format argument ran into a problem that couldn't be +--- otherwise reported. Please file a bug against Vim if you run +--- into this, copying the exact format string and parameters that +--- were used. +--- --- @param fmt any --- @param expr1? any --- @return any diff --git a/runtime/lua/vim/lsp/util.lua b/runtime/lua/vim/lsp/util.lua index a4c8959b99..ec0a1b0ab0 100644 --- a/runtime/lua/vim/lsp/util.lua +++ b/runtime/lua/vim/lsp/util.lua @@ -1100,13 +1100,14 @@ function M.make_floating_popup_options(width, height, opts) anchor_below = lines_below > lines_above end + local border_height = get_border_size(opts).height if anchor_below then anchor = anchor .. 'N' - height = math.min(lines_below, height) + height = math.max(math.min(lines_below - border_height, height), 0) row = 1 else anchor = anchor .. 'S' - height = math.min(lines_above, height) + height = math.max(math.min(lines_above - border_height, height), 0) row = 0 end diff --git a/scripts/pvscheck.sh b/scripts/pvscheck.sh index 97757c0848..81f309aeb3 100755 --- a/scripts/pvscheck.sh +++ b/scripts/pvscheck.sh @@ -375,6 +375,7 @@ run_analysis() {( --threads "$(get_jobs_num)" \ --exclude-path src/cjson \ --exclude-path src/xdiff \ + --exclude-path build \ --output-file PVS-studio.log \ --file build/compile_commands.json \ --sourcetree-root . || true diff --git a/src/nvim/api/vim.c b/src/nvim/api/vim.c index b8e0934669..ce3eca52b5 100644 --- a/src/nvim/api/vim.c +++ b/src/nvim/api/vim.c @@ -587,7 +587,7 @@ ArrayOf(String) nvim__get_runtime(Array pat, Boolean all, Dict(runtime) *opts, E FUNC_API_SINCE(8) FUNC_API_FAST { - VALIDATE((!opts->do_source || nlua_is_deferred_safe()), "%s", "'do_source' used in fast callback", + VALIDATE(!opts->do_source || nlua_is_deferred_safe(), "%s", "'do_source' used in fast callback", {}); if (ERROR_SET(err)) { return (Array)ARRAY_DICT_INIT; diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 9a90e430a7..12226dac91 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -1299,7 +1299,7 @@ int eval_foldexpr(win_T *wp, int *cp) // If the result is a string, check if there is a non-digit before // the number. char *s = tv.vval.v_string; - if (!ascii_isdigit(*s) && *s != '-') { + if (*s != NUL && !ascii_isdigit(*s) && *s != '-') { *cp = (uint8_t)(*s++); } retval = atol(s); diff --git a/src/nvim/eval.lua b/src/nvim/eval.lua index 28fb9c6a5c..5a47286980 100644 --- a/src/nvim/eval.lua +++ b/src/nvim/eval.lua @@ -7381,8 +7381,6 @@ M.funcs = { precision, the argument(s) to be used must also be specified using a {n$} positional argument specifier. See |printf-$|. - - *E1520* The conversion specifiers and their meanings are: *printf-d* *printf-b* *printf-B* *printf-o* *printf-x* *printf-X* @@ -7572,6 +7570,14 @@ M.funcs = { echo printf("%1$d at width %2$d is: %01$*2$.3$d", 1, 2) < E1505: Invalid format specifier: %1$d at width %2$d is: %01$*2$.3$d + + *E1507* + This internal error indicates that the logic to parse a + positional format argument ran into a problem that couldn't be + otherwise reported. Please file a bug against Vim if you run + into this, copying the exact format string and parameters that + were used. + ]=], name = 'printf', params = { { 'fmt', 'any' }, { 'expr1', 'any' } }, diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index eb89e0fc9d..95490a0a10 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -3142,9 +3142,6 @@ void f_fullcommand(typval_T *argvars, typval_T *rettv, EvalFuncData fptr) rettv->v_type = VAR_STRING; rettv->vval.v_string = NULL; - if (name == NULL) { - return; - } while (*name == ':') { name++; diff --git a/src/nvim/highlight.c b/src/nvim/highlight.c index 14239f44cc..337f9e968d 100644 --- a/src/nvim/highlight.c +++ b/src/nvim/highlight.c @@ -332,7 +332,7 @@ void update_window_hl(win_T *wp, bool invalid) wp->w_ns_hl_active = ns_id; wp->w_ns_hl_attr = *(NSHlAttr *)pmap_get(int)(&ns_hl_attr, ns_id); - if (!wp->w_ns_hl_attr) { + if (!wp->w_ns_hl_attr) { // -V547 // No specific highlights, use the defaults. wp->w_ns_hl_attr = highlight_attr; } diff --git a/src/nvim/insexpand.c b/src/nvim/insexpand.c index 3ada39c800..5ac40d7238 100644 --- a/src/nvim/insexpand.c +++ b/src/nvim/insexpand.c @@ -3309,7 +3309,7 @@ static int ins_compl_get_exp(pos_T *ini) xfree(st.e_cpt_copy); // Make a copy of 'complete', in case the buffer is wiped out. st.e_cpt_copy = xstrdup((compl_cont_status & CONT_LOCAL) ? "." : curbuf->b_p_cpt); - st.e_cpt = st.e_cpt_copy == NULL ? "" : st.e_cpt_copy; + st.e_cpt = st.e_cpt_copy; st.last_match_pos = st.first_match_pos = *ini; } else if (st.ins_buf != curbuf && !buf_valid(st.ins_buf)) { st.ins_buf = curbuf; // In case the buffer was wiped out. diff --git a/src/nvim/move.c b/src/nvim/move.c index 55cd90c5ae..8eaf40d135 100644 --- a/src/nvim/move.c +++ b/src/nvim/move.c @@ -1313,7 +1313,6 @@ bool scrolldown(long line_count, int byfold) } if (col > width2 && width2 > 0) { row += (int)col / width2; - col = col % width2; } if (row >= curwin->w_height_inner) { curwin->w_curswant = curwin->w_virtcol - (row - curwin->w_height_inner + 1) * width2; @@ -1518,7 +1517,6 @@ void adjust_skipcol(void) } if (col > width2) { row += (int)col / width2; - col = col % width2; } if (row >= curwin->w_height_inner) { if (curwin->w_skipcol == 0) { diff --git a/src/nvim/strings.c b/src/nvim/strings.c index 0d307a760f..cc66f917f8 100644 --- a/src/nvim/strings.c +++ b/src/nvim/strings.c @@ -46,7 +46,7 @@ static const char e_positional_arg_num_type_inconsistent_str_str[] static const char e_invalid_format_specifier_str[] = N_("E1505: Invalid format specifier: %s"); static const char e_aptypes_is_null_nr_str[] - = "E1520: Internal error: ap_types or ap_types[idx] is NULL: %d: %s"; + = "E1507: Internal error: ap_types or ap_types[idx] is NULL: %d: %s"; static const char typename_unknown[] = N_("unknown"); static const char typename_int[] = N_("int"); @@ -1079,7 +1079,7 @@ static int parse_fmt_types(const char ***ap_types, int *num_posarg, const char * any_arg = 1; CHECK_POS_ARG; } - } else if (ascii_isdigit((int)(*(arg = p)))) { + } else if (ascii_isdigit((int)(*p))) { // size_t could be wider than unsigned int; make sure we treat // argument like common implementations do unsigned uj = (unsigned)(*p++ - '0'); @@ -1126,7 +1126,7 @@ static int parse_fmt_types(const char ***ap_types, int *num_posarg, const char * any_arg = 1; CHECK_POS_ARG; } - } else if (ascii_isdigit((int)(*(arg = p)))) { + } else if (ascii_isdigit((int)(*p))) { // size_t could be wider than unsigned int; make sure we // treat argument like common implementations do unsigned uj = (unsigned)(*p++ - '0'); @@ -1155,7 +1155,7 @@ static int parse_fmt_types(const char ***ap_types, int *num_posarg, const char * p++; if (length_modifier == 'l' && *p == 'l') { // double l = long long - length_modifier = 'L'; + // length_modifier = 'L'; p++; } } diff --git a/src/nvim/window.c b/src/nvim/window.c index 16bb7f5df7..04b5afe624 100644 --- a/src/nvim/window.c +++ b/src/nvim/window.c @@ -4261,7 +4261,11 @@ int may_open_tabpage(void) cmdmod.cmod_tab = 0; // reset it to avoid doing it twice postponed_split_tab = 0; - return win_new_tabpage(n, NULL); + int status = win_new_tabpage(n, NULL); + if (status == OK) { + apply_autocmds(EVENT_TABNEWENTERED, NULL, NULL, false, curbuf); + } + return status; } // Create up to "maxcount" tabpages with empty windows. diff --git a/test/functional/autocmd/tabnewentered_spec.lua b/test/functional/autocmd/tabnewentered_spec.lua index f3443f317d..6e167dd55c 100644 --- a/test/functional/autocmd/tabnewentered_spec.lua +++ b/test/functional/autocmd/tabnewentered_spec.lua @@ -35,6 +35,14 @@ describe('TabNewEntered', function() eq('entered', nvim('exec', 'execute "normal \\<C-W>T"', true)) end) end) + describe('with tab split #4334', function() + it('works when create a tab by using tab split command', function() + clear() + nvim('command', 'au! TabNewEntered * let b:entered = "entered"') + nvim('command', 'tab split') + eq('entered', nvim('exec', 'echo b:entered', true)) + end) + end) end) end) diff --git a/test/functional/plugin/lsp/utils_spec.lua b/test/functional/plugin/lsp/utils_spec.lua index 12763cfef5..804dc32f0d 100644 --- a/test/functional/plugin/lsp/utils_spec.lua +++ b/test/functional/plugin/lsp/utils_spec.lua @@ -212,6 +212,14 @@ describe('vim.lsp.util', function() it('places window below for anchor_bias = "below"', function () assert_anchor('below', 'N') end) + + it('bordered window truncates dimensions correctly', function () + local opts = exec_lua([[ + return vim.lsp.util.make_floating_popup_options(100, 100, { border = 'single' }) + ]]) + + eq(56, opts.height) + end) end) end) diff --git a/test/old/testdir/test_fold.vim b/test/old/testdir/test_fold.vim index ccd1bfecf8..e529a94174 100644 --- a/test/old/testdir/test_fold.vim +++ b/test/old/testdir/test_fold.vim @@ -1569,4 +1569,13 @@ func Test_foldcolumn_linebreak_control_char() bwipe! endfunc +" This used to cause invalid memory access +func Test_foldexpr_return_empty_string() + new + setlocal foldexpr='' foldmethod=expr + redraw + + bwipe! +endfunc + " vim: shiftwidth=2 sts=2 expandtab |