Problem: :packadd may lead to heap-buffer-overflow when all entries in
'runtimepath' have the same length (after 9.2.0291).
Solution: Check for comma after current entry properly (zeertzjq).
related: vim/vim#19854
closes: vim/vim#19911bc182ae56e
Problem: too many strlen() calls
Solution: refactor concat_fname() and remove calls to strlen()
(John Marriott)
Function `concat_fnames()` can make up to 5 calls to `STRLEN()` (either
directly or indirectly via `STRCAT()`). In many cases the lengths of
arguments `fname1` and/or `fname2` are either known or can simply be
calculated.
This Commit refactors this function to accept the lengths of arguments
`fname1` and `fname2` as arguments. It also adds new argument `ret` to
return the resulting string as a `string_T`.
Additionally:
- function `add_pack_dir_to_rtp()` in `scriptfile.c`:
Use a `string_T` to store local variables `new_rtp` and `afterdir`.
Replace calls to `STRCAT()` with calls to `STRCPY()`.
Change type of variable `keep` to `size_t` for consistency with
other lengths.
- function `qf_get_fnum()` in `quickfix.c`:
Use a `string_T` to store local variables `ptr` and `bufname`
- function `qf_push_dir()` in `quickfix.c`:
Use a `string_T` to store local variable `dirname`.
Replace call to `vim_strsave()` with `vim_strnsave()`.
- function `qf_guess_filepath()` in `quickfix.c`:
Use a `string_T` to store local variable `fullname`.
- function `make_percent_swname()` in `memline.c`:
Rename some variables to better reflect their use.
Use a `string_T` to store local variables `d` and `fixed_name`.
Slightly refactor to remove need to create an extra string.
- function `get_file_in_dir()` in `memline.c`:
Use a `string_T` to store local variables `tail` and `retval`.
Move some variables closer to where they are used.
- function `cs_resolve_file()` in `if_cscope.c`:
Use a `string_T` to store local variable `csdir`.
Remove one call to `STRLEN()`.
- function `add_pathsep()` in `filepath.c`:
Refactor and remove 1 call to `STRLEN()`
- function `set_init_xdg_rtp()` in `option.c`:
Use a `string_T` to store local variable `vimrc_xdg`.
closes: vim/vim#19854cb51add7ae
Co-authored-by: John Marriott <basilisk@internode.on.net>
Co-authored-by: Christian Brabandt <cb@256bit.org>
Problem: runtime(zip): may write using absolute paths
(syndicate)
Solution: Detect this case and abort on Unix, warn in the documentation
about possible issues
46f530e517
Co-authored-by: Christian Brabandt <cb@256bit.org>
Problem: Commands that rely on Git may need its version to perform more
targeted actions (like decide which arguments are safe to use).
For performance, computing this version is delayed up until it is
needed (like to not compute on regular startup), but not done before
every Git operation (as it is too much and can be done better).
This requires storing the Git version in a variable which is currently
initiated via `vim.version.parse()` call (most probably because it was
easier to handle Lua types this way).
However, the problem is that this results in sourcing `vim.version`
and computing `vim.version.parse` on every startup even if no Git
operation would be done.
Solution: Don't call `vim.version.parse()` during `require('vim.pack')`
and ensure its more precise lazy computation.
Problem:
Running `:Open` on an open buffer does not run `vim.ui.open()` on that file, requiring the user to type `:Open %`. This is inconsistent with most other vim commands which accept files, which default to the current buffer's file.
Solution:
Default to the current file when `:Open` is used without arguments.
Problem:
On Windows, `:!echo тест` shows `????` because the console code page defaults to a legacy ANSI encoding (e.g. CP1252) instead of `UTF-8`
Solution:
Call `SetConsoleOutputCP(CP_UTF8)` and `SetConsoleCP(CP_UTF8)` in `do_os_system()` before spawning child processes, and restore the original values after. It covers both `:!` and `system()` since they both go through `do_os_system()`
Problem:
Opening .tar.gz or .zip URLs shows raw binary instead of using the archive plugins.
Solution:
Similar to the original netrw implementation, the autocmd should detect
archive URLs, download them to a temp file and the open them with
tar/zip handlers already bundled as vim plugins.
Problem:
Apparently vim.SystemCompleted.stdout can also be nil, even without a
custom stdout handler. (Although the docs can be interpreted otherwise).
Solution:
Explicitly check for nil and set the result body to an empty string if
stdout was nil.
Problem: Computing number of threads for parallel asynchronous
computation using `uv.cpu_info()` can be slow. This is especially
noticeable since it is pre-computed on every `require('vim.pack')` and
not only when parallelism is needed.
Solution: Use `uv.available_parallelism()` to compute number of threads
in a helper function.
vim-patch:9.2.0286: still some unnecessary (int) casts in alloc()
vim-patch:9.2.0288: libvterm: signed integer overflow parsing long CSI args
vim-patch:bd8b6c6b0 CI: Bump codecov/codecov-action
vim-patch:9.2.0294: if_lua: lua interface does not work with lua 5.5
vim-patch:9.2.0297: libvterm: can improve CSI overflow code
vim-patch:8.2.0356: MS-Windows: feedkeys() with VIMDLL cannot handle CSI
vim-patch:8.2.0647: MS-Windows: repeat count for events was not used
Problem: When messages are appended to an already expanded cmdline,
the spilled lines indicator is not updated.
Solution: Remove early return for updating virtual text while cmdline is
expanded, guard updating "msg" virt_text at callsite instead.
Problem: Specifying an URL (e.g., Github URL for a PR commit) on the
command line does not work since it will check it against the pinned
checksum.
Solution: Allow overriding `DEPS_IGNORE_SHA` from the command line as
well.
Problem: Crash on exit after closing v:stderr channel when piping
to stdin.
Solution: Reopen stderr as /dev/null or NUL instead of closing it.
This also avoids writing to an related file if one is opened
after closing v:stderr.
Problem: Some internal variables are not modified
Solution: Add const qualifier to static table data
(Hirohito Higashi).
Several static arrays that are never modified at runtime were missing the
const qualifier. Add const to move them from .data to .rodata section.
closes: vim/vim#199013c79e33aeb
Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
Problem: Currently `colnr_T` and `int` and the same type, so casting
`int *` to `colnr_T *` is redundant. Additionally, even if
they are changed to different types in the future, these casts
are incorrect as they won't work on big-endian platforms.
Solution: Remove the casts. Also fix two cases of passing false instead
of 0 to an integer argument (zeertzjq).
related: vim/vim#19672
closes: vim/vim#1990718cd55dbc4
Problem: 'showcmd' shows wrong Visual block size with 'linebreak' after
end char (after 7.4.467).
Solution: Exclude 'linebreak' from end position. Also fix confusing test
function names.
closes: vim/vim#1990808bd9114c1
Problem: 'linebreak' may lead to wrong Visual block highlighting when
end char occupies multiple cells (after 7.4.467).
Solution: Exclude 'linebreak' from the ending column instead of setting
'virtualedit' temporarily (zeertzjq).
fixes: vim/vim#19898closes: vim/vim#1990023be1889d1
- Don't go over 78 columns.
- Change the first "and" to "or", as "or" is used below.
- Change "takes one" to "switches", as "one" may be mistaken as
referring to the command instead of the user.
- Use backticks in :h 'autowriteall' like in :h 'autowrite'.
closes: vim/vim#19859af58a9f5e9
vim-patch:f4f175332 translation(ru): updated the Russian man page the xxd
vim-patch:e4502b603 translation(ru): updated lang/README.ru.txt
vim-patch:2c976d0de SECURITY.md: clarify the use of AI
vim-patch:9.2.0279: terminal: out-of-bounds write with overlong CSI argument list
vim-patch:9d83ca5ca runtime(preproc_indent): Ignore Swapfiles when loading buffers
Co-authored-by: marvim <marvim@users.noreply.github.com>
Problem: filetype: not all ObjectScript routines are recognized
Solution: Also detect "%RO" and "iris" patterns inside *.rtn files
(Hannah Kimura)
closes: vim/vim#19873863e85e00a
Co-authored-by: Hannah <hannah.kimura@intersystems.com>
Sway 1.11 added `security_context_v1` metadata as criteria:
- `sandbox_engine`
- `sandbox_app_id`
- `sandbox_instance_id`
Sway 1.12 will add the `tag` criteria for `xdg_toplevel_tag_v1`, as
well as the `hdr` output option (with options `on`, `off`, and
`toggle`).
closes: vim/vim#19884ff6f277a4d
Co-authored-by: Felix Pehla <29adc1fd92@gmail.com>
Problem: :syn sync grouphere may go beyond end of line.
Solution: Start searching for the end of region at the end of match
instead of a possibly invalid position (zeertzjq).
closes: vim/vim#19896b7cffc8434
Request less backtracking to function-name candidates for
nonlinear patterns with any regexp engine BUT force using
the old engine with these patterns to avoid incurring an
additional penalty, according to ":syntime report", when the
new regexp engine is preferred.
fixes: vim/vim#19847closes: vim/vim#1984912f6f20552
Co-authored-by: Aliaksei Budavei <0x000c70@gmail.com>
FAILED test/functional/terminal/cursor_spec.lua @ 419: :terminal cursor uses the correct attributes
test/functional/terminal/cursor_spec.lua:448: Expected objects to be the same.
Passed in:
(string) 'block'
Expected:
(string) 'vertical'
stack traceback:
test/functional/terminal/cursor_spec.lua:448: in function <test/functional/terminal/cursor_spec.lua:419>
Problem:
LSP error responses implicitly rely on a custom `__tostring` function
(`vim.lsp.rpc.format_rpc_error`) for formatting. This causes errors that are not
created via `vim.lsp.rpc.error` to behave inconsistently with those that are.
Furthermore, we usually use `log.error` to print these errors, which uses
`vim.inspect` under the hood, so the custom `__tostring` provides little
benefit.
This increases the difficulty of refactoring the code, as it tightly couples RPC
error handling with the LSP.
Solution:
Convert every potential `__tostring` call to an explicit one. Since we don't
describe this behavior in the documentation, this should not be a breaking
change.
This PR creates a C function `nts_parser_parse_buf()`
which is like `ts_parser_parse_string()` but instead can be passed
an nvim buffer number to parse.