In Vim a lot of filesystem functions have been moved to filepath.c.
However, some of these functions actually deal with file contents, and
Nvim's filesystem-related functions are spread out in a different way.
Therefore, it's better to use a different file for these functions.
Problem: Cannot browse zipfiles with the unzip program found
on FreeBSD.
Solution: Adjust command arguments.
Unzip found on FreeBSD complain about missing argument with the
zipinfo modifier '-Z -1'. Joining arguments seems to work
for both implementations.
Also change `:sil!` to `:sil` so that error messages are properly
reported (per review of Christian Brabandt).
related: vim/vim#15411f0e9b72c8f
Co-authored-by: Damien <141588647+xrandomname@users.noreply.github.com>
* do not capitalize after a double colon when introducing a list
* Capitalize a header line
closes: vim/vim#15433217d3c17c6
Co-authored-by: Christian Brabandt <cb@256bit.org>
Since #29315 we are also preprocessing header files in order to find
functions which need prototype declarations. gcc emits a spurious
"warning: #pragma once in main file" even when when you are just
using `gcc -E` which causes a bit of noise in compiler output.
As a workaround, surpress all warnings for this step, this should be pretty
much harmless as we will still get preprocessor warnings when doing
actual compilation `gcc -c` later.
reference: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89808
This also makes shada reading slightly faster due to avoiding
some copying and allocation.
Use keysets to drive decoding of msgpack maps for shada entries.
Problem:
- Current lua indentexpr does not indent for '(' ')'.
- Missing indent test for lua.
Solution:
- Match '(', ')' in `function GetLuaIndentIntern`.
- Add an indent test for lua.
closes: vim/vim#15364c0f7505ede
Co-authored-by: Yinzuo Jiang <jiangyinzuo@foxmail.com>
Problem: After 6f1cbfc9ab fnameescape()
is no longer called on the name of the file to be extracted.
However, while spaces indeed don't need to be escaped, unzip
treats '[' as a wildcard character, so it need to be escaped.
Solution: Escape '[' on both MS-Windows and Unix.
From the docs it seems '*' and '?' also need escaping, but they seem to
actually work without escaping.
fixes: neovim/neovim#29977closes: vim/vim#15427c5bdd66558
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
Magenta background Todo is too bright and might interfere with DiffText.
Make it less strong, without background, bold.
closes: vim/vim#154236228481b8e
Co-authored-by: Maxim Kim <habamax@gmail.com>
Problem: some patterns are used as a replacement for several explicit
extension matches (like '%.[Ss][Yy][Ss]$', '%.php%d$', etc.).
They usually correspond to Vim's "ignore case" regexes (like
'*.sys\c') and "convenience" patterns to not define many of them (like
'*.php\d').
As matching extension directly is faster and more explicit, it should
be preferred.
Solution: move all such patterns to direct extension match.
Problem: some patterns are used as a replacement for one-two explicit
file matches (like '^[mM]akefile$'). As matching file name directly is
faster and more explicit, it should be preferred.
Solution: move those patterns to direct file name match.
NOTE: this is not strictly backwards compatible, because exact file
name matching is done *before* pattern matching. If user has
conflicting `vim.filetype.add()` call with high priority (like with
`pattern='file$'` and `priority=100`), after this change it will be
ignored (i.e. 'makefile' will match exactly).
Judging by converted cases, it seems reasonable to prefer exact
matches there.
Problem: [security] double-free in dialog_changed()
(SuyueGuo)
Solution: Only clear pointer b_sfname pointer, if it is different
than the b_ffname pointer. Don't try to free b_fname,
set it to NULL instead.
fixes: vim/vim#15403
Github Advisory:
https://github.com/vim/vim/security/advisories/GHSA-46pw-v7qw-xc2fb29f4abcd4
Co-authored-by: Christian Brabandt <cb@256bit.org>
- common_function() has always been in evalfunc.c in Vim
- return_register() has always been in evalfunc.c in Vim
- get_user_input() was moved to ex_getln.c in Vim 8.1.1957
- tv_get_lnum_buf() was moved to typval.c in Vim 8.2.0847
Problem: filetype: goaccess config file not recognized
Solution: detect 'goaccess.conf' as goaccess filetype, also
include a basic syntax and ftplugin (Adam Monsen)
Add syntax highlighting for GoAccess configuration file.
GoAccess is a real-time web log analyzer and interactive viewer that
runs in a terminal in *nix systems or through your browser.
GoAccess home page: https://goaccess.iocloses: vim/vim#154140aa65b48fb
Co-authored-by: Adam Monsen <haircut@gmail.com>
Make `:Sexplore` / `:Hexplore` / `:Vexplore` commands honor the user
`&split{right,below}` settings (or netrw-specific `g:netrw_alt{o,v}`)
instead of hardcoding a split direction. Similarly, update banged
variants of the two latter commands to follow the inverted preference.
closes: vim/vim#15417c527d90fae
Co-authored-by: Ivan Shapovalov <intelfx@intelfx.name>
Problem:
Tests have lots of exec_lua calls which input blocks of code
provided as unformatted strings.
Solution:
Teach exec_lua how to handle functions.
When the cursor is moved we terminate any active OSC 8 sequences to
prevent the sequence from inadvertently spanning regions it is not meant
to span. However, if we do not also reset the TUI's active attr id
(print_attr_id) then the TUI does not "know" that it's current attribute
set has changed. When cursor_goto is called to wrap a line, the TUI does
not recompute the attributes so the OSC 8 sequence is not restarted
again.
When we terminate an OSC 8 sequence before moving the cursor, also reset
the active attr id so that the attributes are recomputed for URLs.
Problem: Wrong comment for "len" argument of call_simple_func().
Solution: Remove the "or -1 to use strlen()". Also change its type to
size_t to remove one cast. (zeertzjq)
closes: vim/vim#15410c1ed788c1b
Problem: Calling a function from an "expr" option has too much overhead.
Solution: Add call_simple_func() and use it for 'foldexpr'
87b4e5c5db
Cherry-pick a call_func() change from patch 8.2.1343.
Add expr-option-function docs to options.txt.
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Problem: Vim9: using a script-local function requires using "s:" when
setting 'completefunc'.
Solution: Do not require "s:" in Vim9 script. (closesvim/vim#9796)
1fca5f3e86
vim-patch:8.2.4417: using NULL pointer
Problem: Using NULL pointer.
Solution: Set offset after checking for NULL pointer.
e89bfd212b
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Problem: too many strlen() calls in syntax.c
Solution: refactor code to reduce the number or strlen() calls,
get rid of un-used SYN_NAMELEN macro
(John Marriott)
closes: vim/vim#15368b4ea77185c
Co-authored-by: John Marriott <basilisk@internode.on.net>
Problem: ex: trailing dot is optional for :g and :insert/:append
Solution: don't break out early, when the next command is empty.
(Mohamed Akram)
The terminating period is optional for the last command in a global
command list.
closes: vim/vim#154070214680a8e
Co-authored-by: Mohamed Akram <mohd.akram@outlook.com>
Problem: [security] use-after-free in tagstack_clear_entry
(Suyue Guo )
Solution: Instead of manually calling vim_free() on each of the tagstack
entries, let's use tagstack_clear_entry(), which will
also free the stack, but using the VIM_CLEAR macro,
which prevents a use-after-free by setting those pointers
to NULL
This addresses CVE-2024-41957
Github advisory:
https://github.com/vim/vim/security/advisories/GHSA-f9cr-gv85-hcr48a0bbe7b8a
Co-authored-by: Christian Brabandt <cb@256bit.org>
Problem: [security]: use-after-free in check_argument_type
Solution: Reset function type pointer when freeing the function type
list
function pointer fp->uf_func_type may point to the same memory, that was
allocated for fp->uf_type_list. However, when cleaning up a function
definition (e.g. because it was invalid), fp->uf_type_list will be
freed, but fp->uf_func_type may still point to the same (now) invalid
memory address.
So when freeing the fp->uf_type_list, check if fp->func_type points to
any of those types and if it does, reset the fp->uf_func_type pointer to
the t_func_any (default) type pointer
closes: vim/vim#136520f28791b21
Co-authored-by: Christian Brabandt <cb@256bit.org>
Problem: [security]: use-after-free in exec_instructions()
Solution: get tv pointer again
[security]: use-after-free in exec_instructions()
exec_instructions may access freed memory, if the GA_GROWS_FAILS()
re-allocates memory. When this happens, the typval tv may still point to
now already freed memory. So let's get that pointer again and compare it
with tv. If those two pointers differ, tv is now invalid and we have to
refresh the tv pointer.
closes: vim/vim#136215dd41d4b63
Co-authored-by: Christian Brabandt <cb@256bit.org>
Problem: Coverity warning in cstrncmp()
(after v9.1.0645)
Solution: Change the type of n2 to int.
(zeertzjq)
________________________________________________________________________________________________________
*** CID 1615684: Integer handling issues (INTEGER_OVERFLOW)
/src/regexp.c: 1757 in cstrncmp()
1751 n1 -= mb_ptr2len(s1);
1752 MB_PTR_ADV(p);
1753 n2++;
1754 }
1755 // count the number of bytes to advance the same number of chars for s2
1756 p = s2;
>>> CID 1615684: Integer handling issues (INTEGER_OVERFLOW)
>>> Expression "n2--", which is equal to 18446744073709551615, where "n2" is known to be equal to 0, underflows the type that receives it, an unsigned integer 64 bits wide.
1757 while (n2-- > 0 && *p != NUL)
1758 MB_PTR_ADV(p);
1759
1760 n2 = p - s2;
1761
1762 result = MB_STRNICMP2(s1, s2, *n, n2);
closes: vim/vim#15409e8feaa354e
`buf.code_action` always included diagnostics on a given line from all
clients. Servers should only receive diagnostics they published, and in
the exact same format they sent it.
Should fix https://github.com/neovim/neovim/issues/29500
inotifywait man page specifies:
The file must be specified with a relative or absolute path according to whether a relative or absolute path is given for watched directories.
So it would only work this way in case the path is relative (which at least for gopls it is not)