Problem: When garbage collection runs, the list of recorded buffer
changes may be incorrectly freed (Sainnhe Park).
Solution: In garbage_collect(), iterate through all buffers and call
set_ref_in_list() for b_recorded_changes to ensure the list
and its contents are marked as reachable (Paul Ollis).
fixes: #19300closes: #19375
Signed-off-by: Paul Ollis <paul@cleversheep.org>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: When a popup window partially overlaps a wide character
it results in truncated or garbage display.
Solution: When a wide character is partially blocked by a popup, clear both
cells in the screen buffer to prevent garbage (Yasuhiro Matsumoto).
closes: #19271
Signed-off-by: Yasuhiro Matsumoto <mattn.jp@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
The set_by_lua_block directive of the Lua module takes an additional
variable as an argument which currently breaks the detection of inline
Lua blocks. For example:
set_by_lua_block $myvar {
return tonumber(ngx.var.myothervar)-1
}
closes: #19362
Signed-off-by: Josef Schönberger <josef.schoenberger@tum.de>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: Truncation when serializing libsodium encryption parameters.
Solution: Correctly cast to long long type (Yasuhiro Matsumoto).
fixes: #19248closes: #19357
Signed-off-by: Yasuhiro Matsumoto <mattn.jp@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
- Change syntax file maintainer.
- Add Guile and Python command highlighting.
- Update command list to version 12.
- Add foldable regions for the commands 'define', 'if' and 'while'
multiline commands.
- Support documented partial command names.
- Add matchit, browsefilter, and comment formatting support.
- Support embedded C in compiler {code|print} commands.
- Add largely complete settings highlighting and folding.
- Add syntax tests (incomplete).
Thanks to Claudio Fleiner for many years of maintenance.
closes: #10649
Signed-off-by: Doug Kearns <dougkearns@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This reverts commit 0fde6aebdd.
With "v9.1.2134" applied, arbitrary multibyte characters are
not replaced with spurious U+FFFD characters (typically when
the host system is under load); U+FFFD characters that are
intentionally written in an input file continue to remain
present for later output and comparison. The workaround of
"v9.1.1592~3" is no longer necessary.
Also prefer "page_nr" to "nr" in syntax/testdir/runtest.vim
closes: #19348
Signed-off-by: Aliaksei Budavei <0x000c70@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: Buffer overflow in :wlrestore command, caused by assuming
wrong buffer length in vwl_log_handler() (Seungyeon Park)
Solution: Use correct buffer size (512 bytes) in vim_vsnprintf()
to properly truncate long messages.
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: With 'autochdir' win_execute() can corrupt the buffer name,
causing :write to use wrong path.
Solution: Save and restore b_fname when 'autochdir' is active
(Ingo Karkat).
This is caused by a bad interaction of the 'autochdir' behavior,
overriding of the current directory via :lchdir, and the temporary
window switching done by win_execute(), manifesting when e.g. a custom
completion inspects other buffers:
1. In the initial state after the :lcd .. we have curbuf->b_fname =
"Xsubdir/file".
2. do_autochdir() is invoked, temporarily undoing the :lcd .., changing
back into the Xsubdir/ subdirectory.
3. win_execute() switches windows, triggering win_enter_ext() →
win_fix_current_dir() → shorten_fnames(TRUE)
4. shorten_fnames() processes *all* buffers
5. shorten_buf_fname() makes the filename relative to the current
(wrong) directory; b_fname becomes "file" instead of "Xsubdir/file"
6. Directory restoration correctly restores working directory via
mch_chdir() (skipping a second do_autochdir() invocation because
apply_acd is FALSE), but b_fname remains corrupted, with the
"Xsubdir/" part missing.
7. expand("%:p") (and commands like :write) continue to use the
corrupted filename, resolving to a wrong path that's missing the
"Xsubdir/" part.
To fix the problem the short filename is saved if its in effect (i.e.
pointed to by curbuf->b_fname) and 'autochdir' happened. It's then
restored in case of a local cwd override. The conditions limit this
workaround to when 'autochdir' is active *and* overridden by a :lchdir.
closes: #19343
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Ingo Karkat <swdev@ingo-karkat.de>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: Some tests are not valid on OpenBSD.
Solution: Add CheckNotOpenBSD, use it to skip certain tests
(Kevin Goodsell).
Test_readdirex_sort performs locale-dependent sorting. OpenBSD has
minimal locale support.
Test_stdin_no_newline hangs on OpenBSD and FreeBSD. I don't know exactly
why, but it may be due to bash not exiting at the end of the test. This
is skipped in the FreeBSD CI runs because bash is not installed.
Test_detect_fifo uses /dev/fd/ files (via process substitution) as
FIFOs. On OpenBSD the files in /dev/fd are not FIFOs.
closes: #19351
Signed-off-by: Kevin Goodsell <kevin-opensource@omegacrash.net>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: :tab sbuffer may close old tabpage if BufLeave autocommand
splits window (after 9.1.0143).
Solution: Only close other windows if the buffer will be unloaded
(zeertzjq).
related: neovim/neovim#37749
closes: #19352
Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Patch 9.0.1527 (related issue: vim/vim#12362) introduced range checking
for `term_cols` parameter of the various terminal related functions, but
did not update the documentation. This is the fix, hopefully I found
everything that mentions is. Also improve the style for `term_rows` to
match.
Code reference ( https://github.com/vim/vim/blob/master/src/job.c#L456 ):
if (opt->jo_term_cols < 0 || opt->jo_term_cols > 1000)
closes: #19346
Signed-off-by: Kalin Kozhuharov <kalin@thinrope.net>
Signed-off-by: Christian Brabandt <cb@256bit.org>
The translation file should not be included with Vims runtime files.
Translated help files should be made available via a separate project,
like what has been mentioned here:
https://www.vim.org/translations.php
related: #19321
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: search() is used to check for the message from tar that
indicates leading slashes found in the tar archive, or to
check for the leading slashes themselves. However, if
'nowrapscan' is in effect these searches are limited to the
last line and don't find any results. This causes the warning
message from tar to be seen in the buffer, the "Path Traversal
Attack Detected" message to be omitted, and editing actions
can fail. This can be seen, for example, when editing
src/testdir/samples/evil.tar.
Solution: Use the 'w' flag for search() (Kevin Goodsell)
closes: #19333
Signed-off-by: Kevin Goodsell <kevin-opensource@omegacrash.net>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: Terminal doesn't handle split UTF-8 sequence after ASCII.
Solution: Only use one UTF-8 encoding state per vterm state (zeertzjq).
fixes: #16559closes: #18640
Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: Another case of buffer overflow with 'helpfile'.
Solution: Leave room for "tags" in the buffer (zeertzjq).
closes: #19340
Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: [security]: buffer-overflow in 'helpfile' option handling by
using strcpy without bound checks (Rahul Hoysala)
Solution: Limit strncpy to the length of the buffer (MAXPATHL)
Github Advisory:
https://github.com/vim/vim/security/advisories/GHSA-5w93-4g67-mm43
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: tests: Test_diff_screen() fails on BSD
Solution: Use gdiff on BSD systems if available (zeertzjq).
related: #19336
Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Remove `--nonstopmode` because (a) ConTeXt always stops anyway, and (b)
`--nonstopmode` disables SyncTeX unconditionally. Add `--paranoid`,
which prevents the command to descend to `..` and `../..`.
Pass the typesetting command only the name of the input file rather than
its full path, as that is more compatible with ConTeXt's syncing
mechanism.
closes: #19323
Signed-off-by: Lifepillar <lifepillar@lifepillar.me>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: Page scrolling in Insert mode beeps (after 9.1.0211).
Solution: Fix incorrect return value of pagescroll(). Also invert the
return value of scroll_with_sms() to be less confusing and
match comments (zeertzjq).
fixes: #19326closes: #19327
Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: MS-Windows: font size calculation slightly wrong, causing
vertical line gaps (Maxim Kim, after v9.1.2127)
Solution: Update font size calculation when using DirectX
(Yasuhiro Matsumoto).
Use pre-calculated font ascent from font metrics instead of fixed
formula (h * 0.83) to calculate text baseline. This prevents vertical
text shift when font fallback occurs with CJK characters.
closes: #19318
Signed-off-by: Yasuhiro Matsumoto <mattn.jp@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
When using vim9-syntax plugin, :VimKeywordPrg does not lookup functions
correctly, as it relies solely on syntax names to find the help topic.
The syntax keyword used for builtin function is vi9FuncNameBuiltin in
vim9-syntax plugin, not vimFuncName expected by :VimKeywordPrg, so the
fallback rules apply, and there is no fallback rule for function calls.
Fix by just checking if the first char after topic is '(', and if so
assume help topic is a function.
closes: #19320
Signed-off-by: Mark Woods <mwoods.online.ie@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Updated Swedish translation of the Vim tutor from version 1.5 to 1.7.
Added missing lessons:
- Lesson 1.1.5: TEXT EDITING - APPENDING
- Lesson 1.1.6: EDITING A FILE
- Lesson 1.1 SUMMARY
- Lesson 1.2.3: ON OPERATORS AND MOTIONS
- Lesson 1.2.4: USING A COUNT FOR A MOTION
- Lesson 1.2.5: USING A COUNT TO DELETE MORE
- Lesson 1.2 SUMMARY
- Lesson 1.3.2: THE REPLACE COMMAND
- Lesson 1.3 SUMMARY
- Lesson 1.5.3: SELECTING TEXT TO WRITE (visual mode)
- Lesson 1.6: OPEN, APPEND, REPLACE, COPY/PASTE, OPTIONS
- Lesson 1.7: ONLINE HELP
- Lesson 1.8: CREATE A STARTUP SCRIPT
- Lesson 1.9: CONCLUSION
Original Swedish translation by Johan Svedberg.
Updated by Daniel Nylander.
closes: #19321
Signed-off-by: Daniel Nylander <po@danielnylander.se>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Translated by Daniel Nylander.
Covers:
- Text objects (iw, aw, i[, a[, etc.)
- Named registers (a-z)
- Expression register (=)
- Numbered registers (0-9)
- Special registers (+, *, _, -)
- Marks and mark motions
related: #19321
Signed-off-by: Daniel Nylander <po@danielnylander.se>
Signed-off-by: Christian Brabandt <cb@256bit.org>
- Fix typo: paranteser -> parenteser (line 240)
- Fix h j k l navigation block being too wide
- Shorten Swedish text to fit proper column width
Closes feedback from PR #18849
related: #19321
Signed-off-by: Daniel Nylander <po@danielnylander.se>
Signed-off-by: Christian Brabandt <cb@256bit.org>
- fix indent of a closing } after another } on previous line
- fix indent of consequent #+feature lines
- highlight #+features
closes: #19310
Signed-off-by: Maxim Kim <habamax@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Describe the "height" argument when opening the quickfix window.
See: #19302 ("[cl]window" has different behaviour from "[cl]open" about
their argument [height])
related: #19302
closes: #19305
Signed-off-by: Doug Kearns <dougkearns@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
- fix readability issue with IncSearch/CurSearch
- add highlights to some of ftplugins distributed with vim
closes: #19295
Signed-off-by: Mao-Yining <mao.yining@outlook.com>
Signed-off-by: Maxim Kim <habamax@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: blob2str() does not handle UTF-16 encoding
(Hirohito Higashi)
Solution: Refactor the code and fix remaining issues, see below
(Yasuhiro Matsumoto).
blob2str() function did not properly handle UTF-16/UCS-2/UTF-32/UCS-4
encodings with endianness suffixes (e.g., utf-16le, utf-16be, ucs-2le).
The encoding name was canonicalized too aggressively, losing the
endianness information needed by iconv.
This change include few fixes:
- Preserve the raw encoding name with endianness suffix for iconv calls
- Normalize encoding names properly: "ucs2be" → "ucs-2be", "utf16le" →
"utf-16le"
- For multi-byte encodings (UTF-16/32, UCS-2/4), convert the entire blob
first, then split by newlines
convert_string() cannot handle UTF-16 because it uses string_convert()
which expects NUL-terminated strings. UTF-16 contains 0x00 bytes within
characters (e.g., "H" = 0x48 0x00), causing premature termination.
Therefore, for UTF-16/32 encodings, the fix uses string_convert_ext()
with an explicit input length to convert the entire blob at once.
The code appends two NUL bytes (ga_append(&blob_ga, NUL) twice) because
UTF-16 requires a 2-byte NUL terminator (0x00 0x00), not a single-byte
NUL.
- src/strings.c: Add from_encoding_raw to preserve endianness, special
handling for UTF-16/32 and UCS-2/4
- src/mbyte.c: Fix convert_setup_ext() to use == ENC_UNICODE instead of
& ENC_UNICODE. The bitwise AND was incorrectly treating UTF-16/UCS-2
(which have ENC_UNICODE + ENC_2BYTE etc.) as UTF-8, causing iconv
setup to be skipped.
fixes: #19198closes: #19246
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Yasuhiro Matsumoto <mattn.jp@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>