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>
Problem: heap UAF if autocommands from reloading a file changed outside
of Vim wipe its buffer.
Solution: Validate the bufref after buf_reload (Sean Dewar)
closes: #19317
Signed-off-by: Sean Dewar <6256228+seandewar@users.noreply.github.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>
Problem: MS-Windows: DirectX renders font too small in comparison to
the GDI rendering (Linwei, after v9.1.2125)
Solution: Implement proper font clipping (Yasuhiro Matsumoto)
related: #19254
closes: #19304
Signed-off-by: Yasuhiro Matsumoto <mattn.jp@gmail.com>
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>
Problem: vim --version used single column for feature list
(Ben Knoble, after v9.1.1898)
Solution: Restore old behaviour and assume 80 columns, making sure
the feature list is shown in several columns
(Ben Knoble, Hirohito Higashi).
fixes: #19309closes: #19315
Co-authored-by: D. Ben Knoble <ben.knoble+github@gmail.com>
Signed-off-by: Hirohito Higashi <h.east.727@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>
Problem: MS-Windows: DirectX rendering can be improved
Solution: Use lpDx advance, fix vertical text shift and correct
font-size calculations (Yasuhiro Matsumoto).
This changes DirectWrite rendering to:
- Respect lpDx-provided advance widths instead of always adjusting to
cell width.
- Use a fixed baseline derived from cell geometry to prevent vertical
shifts when font fallback occurs (e.g. with CJK characters).
- Correctly convert LOGFONT lfHeight to DirectWrite font size using font
metrics for closer GDI compatibility.
closes: #19254
Signed-off-by: Yasuhiro Matsumoto <mattn.jp@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>
Problem: using NOT with a float returns a float in legacy vim script
(kennypete)
Solution: Return a number instead of a float (Yegappan Lakshmanan)
fixes: #19282closes: #19289
Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: Vim9: Negating a float doesn't result in a boolean
(kennypete)
Solution: Make it return a boolean (Yegappan Lakshmanan).
related: #19282
related: #19289
Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: Vim9: type issue when modifying a variable using :legacy
(kennypete)
Solution: In a vim9 script, when modifying a variable using the legacy
command, check the type (Yegappan Lakshmanan).
fixes: #18531closes: #19292
Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Use standard indent and remove unnecessary bang.
closes: #19285
Signed-off-by: Doug Kearns <dougkearns@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: tests: Test_language_cmd fails on OpenBSD because the test
uses an invalid locale name and expects the command to produce
an error. OpenBSD accepts (almost) any locale name as valid by
design, so the :lang command succeeds and the test fails.
Solution: Slightly update the "bad" locale name to make it something
that OpenBSD considers invalid by adding a dot (but not ending
with ".UTF-8"). Maintain the original two underscores in the
name because that ensures Windows will also see it as invalid
(Kevin Goodsell).
closes: #19280
Signed-off-by: Kevin Goodsell <kevin-opensource@omegacrash.net>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: 'cursorline' and part of 'statusline' are missing after
:diffput to an empty buffer.
Solution: Make sure the cursor doesn't go beyond the last line after
:diffput (zeertzjq)
related: neovim/neovim#37621
closes: #19281
Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: unnecessary braces in terminal.c
(Christ van Willegen, after v9.1.2113)
Solution: Remove braces
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: crash when using 'tagfunc' (Rodrigo Queipo)
Solution: Do not add the user_data to the 'info' dictionary when called
for insert mode completion (the TAG_INS_COMP flag is set).
Completion should not depend on the state of a previous tag
jump. (Yasuhiro Matsumoto)
fixes: #19255closes: #19284
Signed-off-by: Yasuhiro Matsumoto <mattn.jp@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: modeless selection not copied to * register when P in
guioptions (Coacher)
Solution: Make the "P" flag override the "a" and "A" flag
(Foxe Chen)
fixes: #19187closes: #19244
Signed-off-by: Foxe Chen <chen.foxe@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This includes macros, keys etc. which were not highlighted before.
closes: #19276
Signed-off-by: Muntasir Mahmud <muntasir.joypurhat@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
indent/rust.vim behaves incorrectly when a string literal contains the
substring "if".
For example, in this code:
let x = "
motif
";
struct X {
}
indent/rust.vim thinks that the closing "}" should line up with "motif".
This patch fixes the issue by checking whether the "if" is in a string
literal or comment before considering it to be a match for a subsequent
brace (and also by requiring it to start on a word boundary).
Add an indent test to ensure this does not regress.
closes: #19265
Signed-off-by: taylor.fish <contact@taylor.fish>
Signed-off-by: Christian Brabandt <cb@256bit.org>